Floating-Point Classify Single-Precision
The `fclass.s` instruction examines the value in floating-point register `fs1` and writes to integer register `xd` a 10-bit mask that indicates the class of the floating-point number.
The format of the mask is described in the table below. The corresponding bit in `xd` will be set if the property is true and clear otherwise. All other bits in `xd` are cleared. Note that exactly one bit in `xd` will be set. `fclass.s` does not set the floating-point exception flags.
.Format of result of `fclass` instruction. _xd_ bit — Meaning 0 — _fs1_ is $-\infty$. 1 — _fs1_ is a negative normal number. 2 — _fs1_ is a negative subnormal number. 3 — _fs1_ is $-0$. 4 — _fs1_ is $+0$. 5 — _fs1_ is a positive subnormal number. 6 — _fs1_ is a positive normal number. 7 — _fs1_ is $+\infty$. 8 — _fs1_ is a signaling NaN. 9 — _fs1_ is a quiet NaN.
fclass.s xd, fs1
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 111 | 000000000 | fs1 | 00 | 1 | xd | 1 | 0 | 1 | 00 | 11 | |||||||||||||||||||||
| Variable | Bits | Width |
|---|---|---|
fs1 | [19:15] | 5 |
xd | [11:7] | 5 |
check_f_ok($encoding);
Bits<32> sp_value = F[fs1][31:0];
if (implemented?(ExtensionName::D)) {
# check for an incorrectly NaN-boxed value
if (F[fs1][63:32] != 32'hffffffff) {
sp_value = SP_CANONICAL_NAN;
}
}
if (is_sp_neg_inf?(sp_value)) {
X[xd] = 1 << 0;
} else if (is_sp_neg_norm?(sp_value)) {
X[xd] = 1 `<< 1;
} else if (is_sp_neg_subnorm?(sp_value)) {
X[xd] = 1 `<< 2;
} else if (is_sp_neg_zero?(sp_value)) {
X[xd] = 1 `<< 3;
} else if (is_sp_pos_zero?(sp_value)) {
X[xd] = 1 `<< 4;
} else if (is_sp_pos_subnorm?(sp_value)) {
X[xd] = 1 `<< 5;
} else if (is_sp_pos_norm?(sp_value)) {
X[xd] = 1 `<< 6;
} else if (is_sp_pos_inf?(sp_value)) {
X[xd] = 1 `<< 7;
} else if (is_sp_signaling_nan?(sp_value)) {
X[xd] = 1 `<< 8;
} else {
assert(is_sp_quiet_nan?(sp_value), "Unexpected SP value");
X[xd] = 1 `<< 9;
}
F
| S | U | VS | VU |
|---|---|---|---|
| Always | Always | Always | Always |
Version af3eaf9+cheriot.f635218
Data from the RISC-V Unified Database, copyright RISC-V International and contributors.
CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.
This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.