FLEQ.S

RISC-V FLEQ.S Instruction Details

Instruction ManualR-type

Single-precision floating-point quiet less-or-equal comparison; writes x[rd]=1 when true, otherwise 0.

Instruction Syntax

fleq.s rd, rs1, rs2
Operand Breakdown
rd: destination integer register receiving a 0 or 1 comparison result.
rs1/rs2: source floating-point registers; compare instructions do not use an rm rounding mode.
ZfaFFloating-Point Compare

Instruction Behavior

FLEQ.S compares the single-precision floating-point values in f[rs1] and f[rs2] and writes the Boolean result to integer register rd. It is a quiet comparison: quiet NaNs do not set NV, signaling NaNs set NV, and any NaN operand makes the result 0. It requires Zfa and F (which depends on Zicsr); its OP-FP encoding has funct5=10100, fmt=00, and funct3=100 in bits [14:12] (bit 14 set) to select FLEQ, not an rm rounding mode.

FLEQ.S Decode And Execute Animation

Shows the Zfa + F-extension single-precision OP-FP flow: decode fields, read FP operands, perform FLEQ semantics, then write rd.

rd
rs1
rs2
fleq.s
,
,
Execution Context
FLEN=>=32 / fmt=S (00)
funct3: quiet less-or-equal compare
fflags: example fflags remains 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
10100
FLEQ
00
fmt=S
01100
rs2
01011
rs1
100
funct3=100
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xA0C5C553
opcode
1010011 -> OP-FP
funct5/fmt
10100 + S(00) -> FLEQ.S
funct3
100 -> quiet less-or-equal compare
rd/rs
a0(x10) / fa1(f11) / fa2(f12)
read
1.5, 2.25
FP op
1.5 <= 2.25 -> 1
write
a0(x10) = 1; example fflags remains 0
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0xA0C5C553
syntax : fleq.s a0(x10), fa1(f11), fa2(f12)
result : a0(x10) = 1; example fflags remains 0

The comparison result is written to integer register x[rd] and is only 0 or 1; compare instructions do not use rm.

Single-precision Calculation
rs1
fa1(f11) = 1.5
rs2
fa2(f12) = 2.25
result
1.5 <= 2.25 -> 1

The comparison result is written to integer register x[rd] and is only 0 or 1; compare instructions do not use rm.

This animation shows only Zfa + F-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

FLEQ.S writes the floating-point comparison result to integer register x[rd]. It has quiet-comparison semantics, useful when quiet NaNs should not raise NV.

It writes 1 when rs1 <= rs2 is true, otherwise 0; any NaN operand writes 0 and only a signaling NaN sets NV.
FLEQ.S requires Zfa and F.
Its OP-FP encoding uses funct5=10100, fmt=00, and funct3=100 in bits [14:12] (bit 14 set) to select FLEQ; rd is an integer register and funct3 is not an rm rounding field.

Common Usage Scenarios

Comparison & Detection

Understand this scenario with real code like «fleq.s x10, f11, f12 ; x10 = (f11 <= f12) ? 1 : 0 (quiet)».

Floating-Point Conditions

Understand this scenario with real code like «fleq.s x10, f11, f12 ; x10 = (f11 <= f12) ? 1 : 0 (quiet)».

Pre-Use Checklist

Syntax Check
  • rd: destination integer register receiving a 0 or 1 comparison result.
  • rs1/rs2: source floating-point registers; compare instructions do not use an rm rounding mode.
Semantic Check
  • Confirm the result is written to an integer register and is only 0 or 1.
  • Confirm quiet/signaling comparison behavior for NaNs and NV matches the need.

Pitfalls / Common Confusions

Quiet comparisons set NV only for signaling NaNs; a quiet NaN only makes the result 0.
rd is an integer register and receives 0 or 1, not a floating-point value.
The comparison does not use the rm rounding mode.

FAQ

Is rd a floating-point register for FLEQ.S?

No. rd is an integer register holding the Boolean result 0 or 1.

What happens on NaN operands?

Any NaN operand makes the result 0; only signaling NaNs set NV.