FCLASS.Q

RISC-V FCLASS.Q Instruction Details

Instruction ManualR-type

quad-precision floating-point classify; writes a 10-bit one-hot class mask to integer rd.

Instruction Syntax

fclass.q rd, rs1
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
QFloating-Point Compare

Instruction Behavior

FCLASS.Q classifies the quad-precision floating-point value in f[rs1] and writes a 10-bit one-hot mask to integer register rd. The encoding uses the OP-FP opcode, funct5=11100, fmt=Q(11), rs2=00000, and funct3=001; it does not round, compare magnitudes, or set fflags.

FCLASS.Q Decode And Execute Animation

Shows the Q-extension quad-precision OP-FP flow: decode fields, read FP operands, perform FCLASS semantics, then write rd.

rd
rs1
fclass.q
,
Execution Context
FLEN=128 / fmt=Q (11)
funct3: floating-point classify
fflags: does not set fflags
31..27
26..25
24..20
19..15
14..12
11..7
6..0
11100
FCLASS
11
fmt=Q
00000
rs2
01011
rs1
001
funct3=001
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xE6059553
opcode
1010011 -> OP-FP
funct5/fmt
11100 + Q(11) -> FCLASS.Q
funct3
001 -> floating-point classify
rd/rs
a0(x10) / fa1(f11) / rs2=00000
read
-0.0
FP op
class(-0.0) = 0x008
write
a0(x10) = 0x008; does not set fflags
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; quad-precision OP-FP instructions use opcode 1010011.

encoding: 0xE6059553
syntax : fclass.q a0(x10), fa1(f11)
result : a0(x10) = 0x008; does not set fflags

FCLASS writes a 10-bit one-hot class mask and clears the other rd bits; classifying NaNs does not set FP exception flags. The text NaN example is shown as quiet NaN; the official signaling-NaN bit is bit 8.

Quad-precision Calculation
rs1
fa1(f11) = -0.0
result
class(-0.0) = 0x008
FCLASS mask bits
bit 0
-inf
bit 1
negative normal
bit 2
negative subnormal
bit 3
-0
bit 4
+0
bit 5
positive subnormal
bit 6
positive normal
bit 7
+inf
bit 8
sNaN
bit 9
qNaN

FCLASS writes a 10-bit one-hot class mask and clears the other rd bits; classifying NaNs does not set FP exception flags. The text NaN example is shown as quiet NaN; the official signaling-NaN bit is bit 8.

This animation shows only Q-extension ISA-visible OP-FP encoding, example numeric results, and fflags relationship; it does not model FPU pipelines, latency, every IEEE 754 corner case, or microarchitecture.

Quick Understanding & Search Notes

FCLASS.Q does not produce an FP result; it reads one quad-precision FP source and writes the official 10-class one-hot mask to integer rd.

OP-FP opcode is 1010011; funct5=11100, fmt=11, rs2=00000, and funct3=001 select FCLASS.Q.
The 10 mask bits 0..9 cover negative infinity, negative normal, negative subnormal, negative zero, positive zero, positive subnormal, positive normal, positive infinity, sNaN, and qNaN.
FCLASS performs no numeric conversion, no rounding, and sets no fflags; rd is an integer register.

Common Usage Scenarios

Floating Point Basic

Understand this scenario with real code like «fclass.q x10, f0 # x10 = class of f0».

Numerical Computing

Understand this scenario with real code like «fclass.q x10, f0 # x10 = class of f0».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

The result is written to an integer register, not an FP register.
FCLASS returns a 10-bit one-hot class mask, not a 0/1 comparison result.
FCLASS does not set FP exception flags, including for qNaN or sNaN classification.
rs2=00000 is a fixed encoding field, not a second source operand in assembly syntax.

FAQ

Does FCLASS.Q set NV?

No. The official FCLASS semantics state that it does not set floating-point exception flags, even when the source is NaN.

Is the FCLASS.Q result a Boolean?

No. The result is a 10-bit one-hot class mask representing the specific FP class.

What is rs2 for FCLASS.Q?

The assembly syntax has only rd and rs1; the encoded rs2 field is fixed to 00000.