Linux Assemblycollection of fast libraries

Floating-Point Unit (FPU) instructions set

The x87‭ ‬FPU instructions are executed by the so-called "math coprocessor"‬.‭ ‬These instructions operate on floating-point,‭ integer,‭ ‬and binary-coded decimal (BCD) ‬operands.‭ The main purpose of these instructions are to perform floating-point arithmetic.‭ ‬But nowadays we have SIMD instructions that are much faster than FPU.‭ ‬So,‭ please,‭ don't use the FPU in newly written code,‭ because it usage is marked as outdated in Linux ‬64‭ ‬ABI.‭ ‬Use SIMD instead.

Contents

Tip: For detailed information about each instruction please read: Intel Architectures Software Developer’s Manual Volume 2: Instruction Set Reference, A-Z

Data Transfer Instructions

The data transfer instructions move floating-point, integer, and BCD values between memory and the x87 FPU registers. They also perform conditional move operations on floating-point operands.

InstructionMeaning
Integer Operands
FILDLoad integer
FISTStore integer
FISTPStore integer and pop
FISTTPBehaves like the FISTP instruction but uses truncation, irrespective of the rounding mode specified in the floating-point control word (FCW)
Binary-coded Decimal Operands
FBLDLoad BCD
FBSTPStore BCD and pop
Floating-point Operands
FLDLoad floating-point value
FSTStore floating-point value
FSTPStore floating-point value and pop
FXCHExchange register
FCMOVEFloating-point conditional move if equal
FCMOVBFloating-point conditional move if below
FCMOVBEFloating-point conditional move if below or equal
FCMOVUFloating-point conditional move if unordered
FCMOVNEFloating-point conditional move if not equal
FCMOVNBFloating-point conditional move if not below
FCMOVNBEFloating-point conditional move if not below or equal
FCMOVNUFloating-point conditional move if not unordered

Basic Arithmetic Instructions

The basic arithmetic instructions perform basic arithmetic operations on floating-point and integer operands.

InstructionMeaning
Integer Operands
FIADDAdd integer
FISUBSubtract integer
FISUBRSubtract integer reverse
FIMULMultiply integer
FIDIVDivide integer
FIDIVRDivide integer reverse
Floating-point Operands
FADDAdd floating-point
FADDPAdd floating-point and pop
FSUBSubtract floating-point
FSUBPSubtract floating-point and pop
FSUBRSubtract floating-point reverse
FSUBRPSubtract floating-point reverse and pop
FMULMultiply floating-point
FMULPMultiply floating-point and pop
FDIVDivide floating-point
FDIVPDivide floating-point and pop
FDIVRDivide floating-point reverse
FDIVRPDivide floating-point reverse and pop
FPREMPartial remainder
FPREM1IEEE Partial remainder
FRNDINTRound to integer
FABSAbsolute value
FCHSChange sign
FSQRTSquare root
FSCALEScale by power of two
FXTRACTExtract exponent and significant

Transcendental Instructions

The transcendental instructions perform basic trigonometric and logarithmic operations on floating-point operands.

InstructionMeaning
FSINSine
FCOSCosine
FSINCOSSine and cosine
FPTANPartial tangent
FPATANPartial arctangent
F2XM12x − 1
FYL2Xy * log2(x)
FYL2XP1y * log2(x+1)

Load Constants Instructions

The load constants instructions load common constants, such as π, into the x87 floating-point registers.

InstructionMeaning
FLDZLoad +0.0
FLD1Load +1.0
FLDPILoad Pi
FLDL2ELoad log2(e)
FLDLN2Load loge(2)
FLDL2TLoad log2(10)
FLDLG2Load log10(2)

Comparison Instructions

The compare instructions examine or compare floating-point or integer operands.

InstructionMeaning
Integer Operands
FICOMCompare integer
FICOMPCompare integer and pop
Floating-point Operands
FCOMCompare floating-point
FCOMPCompare floating-point and pop
FCOMPPCompare floating-point and pop twice
FCOMICompare floating-point and set EFLAGS
FCOMIPCompare floating-point, set EFLAGS, and pop
FUCOMUnordered compare floating-point
FUCOMPUnordered compare floating-point and pop
FUCOMPPUnordered compare floating-point and pop twice
FUCOMIUnordered compare floating-point and set EFLAGS
FUCOMIPUnordered compare floating-point, set EFLAGS, and pop
FTSTTest floating-point (compare with 0.0)
FXAMExamine floating-point

Control Instructions

The x87 FPU control instructions operate on the x87 FPU register stack and save and restore the x87 FPU state.

InstructionMeaning
FFREEFree floating-point register
FINCSTPIncrement FPU register stack pointer
FDECSTPDecrement FPU register stack pointer
FINITInitialize FPU after checking error conditions
FNINITInitialize FPU without checking error conditions
FSTSWStore FPU status word after checking error conditions
FNSTSWStore FPU status word without checking error conditions
FCLEXClear floating-point exception flags after checking for error conditions
FNCLEXClear floating-point exception flags without checking for error conditions
FSTCWStore FPU control word after checking error conditions
FNSTCWStore FPU control word without checking error conditions
FLDCWLoad FPU control word
FSAVESave FPU state after checking error conditions
FNSAVESave FPU state without checking error conditions
FRSTORRestore FPU state
FSTENVStore FPU environment after checking error conditions
FNSTENVStore FPU environment without checking error conditions
FLDENVLoad FPU environment
FNOPFPU no operation
FWAITWait for FPU

FPU and SIMD State Management Instructions

Two state management instructions were introduced into the IA-32 architecture with the Pentium II processor family

InstructionMeaning
FXSAVESave x87 FPU and SIMD state
FXRSTORRestore x87 FPU and SIMD state
Copyright 2012-2026 Jack Black. All rights reserved.