Extensions
Forms
1 (1 Legacy)
Data
Intel XED v2026.08.23

FPREM1 replaces ST(0) by the remainder of ST(0) divided by ST(1), with the quotient rounded to the nearest integer and ties going to the even one: the remainder of IEEE 754, C’s remainder. Its magnitude is at most half of ST(1)’s, and its sign is whichever makes it so, not the dividend’s; only a zero remainder keeps the dividend’s sign. FPREM truncates the quotient instead, as the 8087 and the 287 did, C’s fmod. Its page covers what they share: the partial remainder with C2 set, the loop that finishes it, and the low quotient bits in C0, C3 and C1.

Rounding the quotient

On Zen 5:

OperandsFPREM1Quotient
7 by 2-14
5 by 212, the even one of 2 and 3
7.5 by 1-0.58
6.5 by 10.56
10 by 0.1, the nearest 80-bit numberabout -1.4 * 10^-19100

Where FPREM’s results are all positive here, FPREM1’s are as close to zero as the quotient allows. In the last row FPREM1 shows how far 10 is from a multiple of the divisor, where FPREM would give almost a whole 0.1. RC plays no part: the remainder is exact, so it never sets PE, and 1.5 by 1 gave -0.5 under rounding toward zero too.

From C

GCC 14 at -O2 compiles remainderl(x, y) on a long double, and remainder on a double, to the loop of fprem1, FNSTSW AX, test ah, 4 and a jne back, calling the library only when the result is a NaN, for errno; with -ffast-math the call goes. Clang 23 calls the library in both cases.

Tiny remainders

The remainder of two normal numbers can be a denormal: 1.5 * 2^-16382 by 2^-16382 gave -2^-16383, exact and without UE while UE was masked. With UE unmasked, Zen 5 left the remainder with its exponent raised by 24576, -2^8193 in place of -2^-16383, set UE and raised #MF.

AMD’s Zen 5 guide lists FPREM1 like FPREM: two macro-ops, of which a core starts one every nine cycles at most.

Forms

Every encoding of FPREM1 that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
FPREM1 FPREM1D9 F5FPU

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

c2 = 0                           # first: an exception leaves it 0
if empty(st0) or empty(st1):
    underflow()                  # IE, SF, C1 = 0
    st0 = INDEFINITE             # C0 and C3 stay
else:
    r = prem1(st0, st1)          # ST(0) - q * ST(1), exact, with q =
                                 # ST(0) / ST(1) to the nearest integer,
                                 # even on a tie: IEEE's remainder
    st0 = r
    c1 = r.quotient & 1          # q's low three bits: C0, C3, C1
    if r.partial:                # the exponents were 64 or more apart:
        c2 = 1                   # q had only the quotient's top 32 to
        c0 = c3 = 0              # 63 bits, truncated; run it again
    elif not is_nan(r):          # a NaN leaves C0 and C3
        c3 = r.quotient >> 1 & 1
        c0 = r.quotient >> 2 & 1

Run on AMD Zen 5 (EPYC 9645): 34 cases.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
FPREM1
ST(0)implicitread, write
ST(1)implicitread
x87 status wordimplicitwrite

Flags

M modified; blank: not affected. How to read.
C0C1C2C3
All forms
MMMM

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.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
X87

FPU
CPUID.01H:EDX[0] FPU

Every x86-64 processor in XED’s model and Zen 3 to Zen 6

More x87 instructions

All 90 x87 instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-368 (FPREM1)
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  5. 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
  6. 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.