FSUB.S
RISC-V FSUB.S Instruction Details
Instruction ManualR-typePerforms single-precision floating-point subtraction: rd = rs1-rs2.
Instruction Syntax
fsub.s rd, rs1, rs2, rm
Operand Breakdown
rd: destination floating-point register receiving the formatted result.
rs1/rs2: source floating-point registers; arithmetic/rounding forms with rm use rm or dynamic frm for rounding mode.
FFloating-Point Arithmetic
Instruction Behavior
FSUB.S subtracts single-precision value in rs2 from rs1; result to rd. R-type. Rounding by rm.
Common Usage Scenarios
Floating Point Basic
Understand this scenario with real code like «fsub.s f0, f1, f2 # f0 = f1-f2 (RNE)».
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
catastrophic cancellation when operands are close