Home/Instructions/Float Less or Equal Half
FLE.H

RISC-V FLE.H Instruction Details

Instruction ManualR-type

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

Instruction Syntax

fle.h rd, rs1, rs2

32-bit OP-FP: funct5[31:27]=10100, fmt[26:25]=10, rs2[24:20], rs1[19:15], funct3[14:12]=000, rd[11:7], opcode[6:0]=1010011; no rm.

rd is integer x0–x31 and rs1/rs2 are FP f0–f31; ABI names are accepted. x0 discards the Boolean result while NV still accrues. Integer and FP registers with the same index belong to separate register files.

Applies to RV32/RV64 full Zfh (requires F, not Zfhmin), FLEN≥32; enable required extensions and FP state. Sources narrower than FLEN require valid NaN-boxing, otherwise they are read as canonical qNaN.

Write 1 for less-or-equal, otherwise 0; any NaN writes 0. Both qNaN and sNaN set NV. fflags accrues exceptions; flag setting alone causes no base FP exception trap.

One source register must have one initial value. The animation starts with fflags=0 and accepts only listed exact finite values plus signed zeros, infinities, qNaN, and sNaN. Steps are teaching views.

ZfhFloating-Point Compare

Instruction Behavior

FLE.H compares the half-precision floating-point values in f[rs1] and f[rs2] and writes the Boolean result to integer register rd. It requires Zfh (which depends on F); Zfhmin contains only data transfer and conversion, not this compare. The encoding uses the OP-FP opcode, funct5=10100, fmt=H(10), and funct3=000; it is a signaling comparison that sets NV for any NaN, and any NaN operand makes the result 0.

FLE.H Decode And Execute Animation

Shows the Zfh-extension half-precision OP-FP flow: decode fields, read FP operands, perform FLE semantics, then write rd.

rd
rs1
rs2
fle.h
,
,
Execution Context
FLEN>=32 / fmt=H (10)
funct3: less-or-equal compare
fflags: initial 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
10100
FLE
10
fmt=H
01100
rs2
01011
rs1
000
funct3=000
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xA4C58553
opcode
1010011 -> OP-FP
funct5/fmt
10100 + H(10) -> FLE.H
funct3
000 -> less-or-equal compare
rd/rs
a0(x10) / fa1(f11) / fa2(f12)
read
Source registers not read yet
FP op
Awaiting Execute
write
Not written yet; initial fflags=0
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0xA4C58553
syntax : fle.h a0(x10), fa1(f11), fa2(f12)
result : Not written yet; initial fflags=0

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

Half-precision Calculation
rs1
fa1(f11) = 1.5
rs2
fa2(f12) = 2.25
result
Awaiting Execute

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

Assumes required extensions and FS enabled, valid NaN-boxing, and initial fflags=0. Finite inputs use the exact whitelist; signed zeros, infinities, qNaN, and sNaN are supported. Other inputs stop execution. One source register must have one initial value; rd=x0 discards only the integer write while NV still accrues. Steps are teaching views.

This animation shows only Zfh-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

FLE.H writes the half-precision FP comparison result to integer register x[rd]; the result is only 0 or 1.

OP-FP opcode is 1010011; funct5=10100, fmt=10, and funct3=000 select FLE.H.
It writes 1 when rs1 <= rs2 is true, otherwise 0; any NaN operand writes 0.
FLE.H is a signaling comparison: any NaN sets NV.
The comparison produces no FP result; bits[14:12] are funct3=000 selecting LE, not an rm rounding mode; rd is an integer register.

Common Usage Scenarios

Comparison & Detection

Understand this scenario with real code like «fle.h x10, f0, f1 # x10 = (f0<=f1)».

Floating-Point Conditions

Understand this scenario with real code like «fle.h x10, f0, f1 # x10 = (f0<=f1)».

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

FLE is a signaling comparison: either qNaN or sNaN produces 0 and sets NV.
rd is an integer register and receives 0 or 1, not a floating-point value.
The comparison does not use the rm rounding mode.
fflags accrues exception flags; rd=x0 discards only the integer write, retaining NV side effects.

FAQ

Is rd a floating-point register for FLE.H?

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

What happens on NaN operands for FLE.H?

Any NaN operand makes the result 0 and sets NV.

Does FLE.H use rm?

No. The funct3 field selects the comparison type, and the result is an integer Boolean.