Instruction
FNINIT
Resets the x87 unit to its default state without first handling pending exceptions; FINIT is FWAIT followed by it.
- Extensions
- Mnemonics
- FNINIT, FINIT
- Forms
- 1 (1 Legacy)
- Data
- Intel XED v2026.08.23
FNINIT puts the x87 unit in its initial state:
- the control word becomes 037FH: every exception masked, 64 bits of precision, rounding to nearest (see FLDCW);
- the status word becomes 0: no exception flags, C0 to C3 clear, TOP 0;
- every register is tagged empty;
- the last instruction pointer, data pointer and opcode are cleared, which the 80387 did not do, Intel’s manual notes.
The XMM registers and MXCSR stay as they were. FINIT, listed on this page, is FWAIT followed by FNINIT.
The registers keep their bits
FNINIT only marks the registers empty; it does not zero them, as AMD’s manual says. On Zen 5, an FNSAVE right after it still stored the eight old values, now numbered from TOP 0. An x87 instruction cannot read them any more, since an empty register is a stack underflow, but they are not erased. Initializing the x87 state through XRSTOR, with its bit clear in XSTATE_BV, does zero them, besides setting the same control and status words.
No wait
The N means that FNINIT does not first check for a pending unmasked exception. With ES set in the status word, Zen 5 ran it without #MF, and the exception was gone: FNINIT clears the flags that would have raised it. FINIT’s FWAIT would deliver that #MF first. So FNINIT is the way to reset the unit when its state is unknown or broken, for example in an exception handler that will not resume the faulting code.
In practice
C has no way to ask for FNINIT short of inline assembly, and compiled code does not need it. A function that leaves values on the stack, or MMX code without EMMS, makes later x87 loads overflow, and FNINIT is the blunt repair, which discards the control word too. FNCLEX clears only the exception flags, FFREE empties one register, and FLDENV or FRSTOR load a saved state.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
FNINIT
FNINIT | DB E3 | FPU |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
fcw = 0x037F # every exception masked, 64 bits,
# to nearest
fsw = 0 # TOP 0, no flags, C0-C3 0
ftw = 0xFFFF # every register empty; their values
# stay
Run on AMD Zen 5 (EPYC 9645): 5 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
FNINIT | ||
x87 control word | implicit | write |
x87 tag word | implicit | write |
x87 status word | implicit | write |
Flags
| C0 | C1 | C2 | C3 |
|---|---|---|---|
| All forms | |||
| M | M | M | M |
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-345 (FINIT/
FNINIT) - 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
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.