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

FTST compares ST(0) with zero and reports the answer in the condition codes, as FCOM does with another value: C3, C2 and C0 clear when ST(0) is greater, C0 set when it is less, C3 set when it is zero of either sign, and all three when it is a NaN or unsupported. C1 is cleared. It is two bytes, D9 E4, with no operand, needs no zero in a register and pops nothing.

A signaling compare

Intel’s manual calls the comparison unordered, but that only names the fourth outcome: FTST raises the invalid-operation exception for a NaN of either kind, as FCOM does, not only for a signaling one as FUCOM does. AMD’s manual lists QNaNs among its IE causes too, and Zen 5 raised IE for QNaNs of both signs, an SNaN and the unsupported encodings it was given (an unnormal, a pseudo-infinity and a pseudo-NaN). A denormal raises DE and compares as its value, which is never zero: Zen 5 reported a positive denormal as greater.

With IE unmasked, Intel’s table does not say whether the codes are written. Zen 5 wrote them as unordered for a QNaN and for an empty ST(0), cleared C1, and #MF came at the next waiting instruction; with DE unmasked it wrote the result of the compare. With an exception already pending, the #MF came at FTST itself and the codes stayed.

Where it still appears

C’s x > 0 may raise the invalid exception for a NaN, so it can use FTST, and GCC 14 does at -O2 with -m32 -march=i386 on a double: FLD, FTST, FNSTSW AX, fstp st(0) and test ah, 69, which is true only when all three codes are clear. For x == 0, which must stay quiet, it loads FLDZ and uses FUCOMPP instead. On processors with FCOMI, and in 64-bit code, compilers compare with an FLDZ and FCOMIP or FUCOMIP, which set RFLAGS directly; FTST has no form that does. Clang 23 used no FTST in these tests, even for i386: it loads FLDZ and compares with FUCOMPP.

FXAM classifies ST(0) without raising anything. AMD’s Zen 5 guide lists FTST as one macro-op on pipe FP1, one per cycle.

Forms

Every encoding of FTST that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
FTST FTSTD9 E4FPU

Operation

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

if empty(st0):
    underflow()
    x = 3                            # unordered
else:
    x = comi(st0, 0)                 # against +0; any NaN raises IE
c3 = x in (2, 3)                     # set with IE or DE unmasked too
c2 = x == 3
c0 = x in (1, 3)
c1 = 0

Run on AMD Zen 5 (EPYC 9645): 22 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
FTST
ST(0)implicitread, write
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-400 (FTST)
  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.