How is FNMSUB.H different from FMUL plus add/subtract?
FNMSUB.H is fused: the product is not first rounded into an intermediate FP result; the whole expression is rounded once at the end according to rm.
half-precision negated fused multiply-subtract: rd = -(rs1 * rs2) + rs3, with one final rounding according to rm.
FNMSUB.H uses the R4 four-register format for half-precision negated fused multiply-subtract. The rs1*rs2 product is not rounded or written as an intermediate result; it is combined with rs3 as one fused expression, rounded once according to rm, and written to rd.
Shows the Zfh-extension half-precision R4 fused multiply-add flow: decode fields, read FP operands, perform FNMSUB semantics, then write rd.
The word is split as an R4-type instruction; FNMSUB.H uses its dedicated major opcode 1001011, not the ordinary OP-FP opcode.
The default example -(1.5 * 2.0) + 1.0 = -2.0 is exactly checkable; the fused operation rounds once at the end, so example fflags remains 0.
The default example -(1.5 * 2.0) + 1.0 = -2.0 is exactly checkable; the fused operation rounds once at the end, so example fflags remains 0.
This animation shows only Zfh-extension ISA-visible R4 encoding, example numeric results, and fflags relationship; it does not model FPU pipelines, latency, every IEEE 754 corner case, or microarchitecture.
FNMSUB.H's key points are R4 encoding and fused semantics: rs3 is a real third source register, and the product plus/minus term forms one exact intermediate expression that is rounded only once.
Understand this scenario with real code like «fnmsub.h f0, f1, f2, f3, rne # f0 = -(rs1 * rs2) + rs3».
Understand this scenario with real code like «fnmsub.h f0, f1, f2, f3, rne # f0 = -(rs1 * rs2) + rs3».
FNMSUB.H is fused: the product is not first rounded into an intermediate FP result; the whole expression is rounded once at the end according to rm.
It needs rd, rs1, rs2, rs3, and rm fields; bits 31..27 hold rs3, not an ordinary R-type funct5 field.
It can set FP exception flags under the official FP rules, such as inexact, overflow, underflow, or invalid operation; the default animation uses exact finite values, so it shows fflags remaining 0.