How is FMADD.H different from FMUL plus add/subtract?
FMADD.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 fused multiply-add: rd = (rs1 * rs2) + rs3, with one final rounding according to rm.
FMADD.H uses the R4 four-register format for half-precision fused multiply-add. 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 FMADD semantics, then write rd.
Leave rm empty to use the assembly default dyn encoding and fcsr.frm below.
The word is split as an R4-type instruction; FMADD.H uses its dedicated major opcode 1000011, not the ordinary OP-FP opcode.
The default example (1.5 * 2.0) + 0.5 = 3.5 is exactly checkable; the fused operation rounds once at the end, so example fflags remains 0.
The default example (1.5 * 2.0) + 0.5 = 3.5 is exactly checkable; the fused operation rounds once at the end, so example fflags remains 0.
Assumes the extension is available, FS enabled, correctly NaN-boxed inputs, and initial fflags=0. Only nonzero finite exact whitelisted inputs and nonzero whitelisted results are accepted; zero and rounding/exception boundaries are outside this animation. One source register must have one initial value; rd may overlap a source, and f0 accepts writeback. Steps are teaching views.
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.
FMADD.H adds rs3 to rs1×rs2 with one final rounding; rs3 is a separately encoded third source register.
Understand this scenario with real code like «fmadd.h f0, f1, f2, f3, rne # f1=1.5, f2=2, f3=0.5 -> f0=3.5».
Understand this scenario with real code like «fmadd.h f0, f1, f2, f3, rne # f1=1.5, f2=2, f3=0.5 -> f0=3.5».
FMADD.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.
Applicable NV, OF, UF, and NX accrue in fflags. Exact teaching examples assume initial fflags=0 and add no flags.