Instruction
FSUBR
Subtracts ST(0) from a float in memory, or ST(0) from ST(i) into ST(0), or ST(i) from ST(0) into ST(i): FSUB with the operands swapped.
- Extensions
- Forms
- 4 (4 Legacy)
- Data
- Intel XED v2026.08.23
FSUBR subtracts with the operands the other way round from
FSUB: the destination receives the source less the
destination. fsubr st, st(i) computes ST(i) - ST(0) into ST(0),
fsubr st(i), st computes ST(0) - ST(i) into ST(i), and the memory
forms compute the single or double less ST(0). FSUBRP
does the same into ST(i) and pops, and FISUBR takes an
integer. The rounding and exceptions are FSUB’s.
Why the memory forms need it
A memory operand can only be the source, and FSUB subtracts the source
from ST(0). To subtract ST(0) from a value in memory, FSUBR does it
without loading the value first: GCC 14 and Clang 23 at -O2 compile
*y - x, with a long double x and a double y, to FLD of x and
fsubr qword ptr [rdi]. With both operands on the stack, they use
FSUBRP or FSUBP, whichever matches the order of the loads: 0.0L - x
is FLD of x, FLDZ and fsubrp st(1), st (see
FCHS for why it is not a negation).
Two bits of the encoding
In the register forms, one opcode bit picks the destination (D8 for ST(0), DC for ST(i)) and the ModRM reg field picks the order of the operands, and the order means the same in both rows: /4 is ST(0) less ST(i), /5 ST(i) less ST(0). Intel’s names say whether the destination is the minuend, so they swap between the rows:
| Bytes | Intel name | Result |
|---|---|---|
| D8 E0+i | FSUB ST(0), ST(i) | ST(0) - ST(i) into ST(0) |
| D8 E8+i | FSUBR ST(0), ST(i) | ST(i) - ST(0) into ST(0) |
| DC E0+i | FSUBR ST(i), ST(0) | ST(0) - ST(i) into ST(i) |
| DC E8+i | FSUB ST(i), ST(0) | ST(i) - ST(0) into ST(i) |
The AT&T syntax names the DC forms the other way round, which is the trap that FDIV’s page describes.
On Zen 5
A register less itself gave +0 under rounding to nearest and toward
zero, including through DC E0, fsubr st(0), st. Subtracting -max from
+max with OE unmasked left the overflowed result in ST(0) with its
exponent reduced by 24576, as Intel’s manual describes for an unmasked
overflow, and #MF followed. AMD’s Zen 5 guide lists FSUBR like FSUB:
one macro-op on pipe FP2, one per cycle.
Forms
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if empty(dest) or empty(src):
underflow() # IE, SF, C1 = 0
dest.write(INDEFINITE) # the QNaN indefinite
else:
dest.write(sub(src, dest)) # reversed: the source less the
# destination
c0 = c2 = c3 = UNDEFINEDRun on AMD Zen 5 (EPYC 9645): 27 cases.
if empty(st0):
underflow() # IE, SF, C1 = 0
st0 = INDEFINITE
else:
st0 = sub(src, st0) # the single or double less ST(0)
c0 = c2 = c3 = UNDEFINEDRun on AMD Zen 5 (EPYC 9645): 12 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
FSUBR m32fp FSUBR m64fp | ||
m32/64fp | explicit | read |
x87 status word | implicit | write |
FSUBR ST(0), st(i) | ||
ST(0) | explicit | read, write |
st(i) | explicit | read |
x87 status word | implicit | write |
FSUBR st(i), ST(0) | ||
st(i) | explicit | read, write |
ST(0) | explicit | read |
x87 status word | implicit | write |
Flags
| C0 | C1 | C2 | C3 |
|---|---|---|---|
| All forms | |||
| U | M | U | U |
Attributes
What else XED records about the forms. How to read.
- All forms
- may abort a TSX transaction
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
X87 | FPU | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
More x87 instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-397 (FSUBR/
FSUBRP/ FISUBR) - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 5: 64-Bit Media and x87 Floating-Point Instructions (26569, rev. 3.16, November 2021), Wayback Machine copy of AMD's PDF
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The text is our own.