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

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

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

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

Load Constants Instructions

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

Comparison Instructions

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

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

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