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
- Data Transfer Instructions
- Integer Operands
- Binary-coded Decimal Operands
- Floating-point Operands
- Basic Arithmetic Instructions
- Integer Operands
- Floating-point Operands
- Transcendental Instructions
- Load Constants Instructions
- Comparison Instructions
- Integer Operands
- Floating-point Operands
- Control Instructions
- FPU and SIMD State Management Instructions
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
Instruction | Meaning |
---|---|
Integer Operands | |
FILD | Load integer |
FIST | Store integer |
FISTP | Store integer and pop |
FISTTP | Behaves like the FISTP instruction but uses truncation, irrespective of the rounding mode specified in the floating-point control word (FCW) |
Binary-coded Decimal Operands | |
FBLD | Load BCD |
FBSTP | Store BCD and pop |
Floating-point Operands | |
FLD | Load floating-point value |
FST | Store floating-point value |
FSTP | Store floating-point value and pop |
FXCH | Exchange register |
FCMOVE | Floating-point conditional move if equal |
FCMOVB | Floating-point conditional move if below |
FCMOVBE | Floating-point conditional move if below or equal |
FCMOVU | Floating-point conditional move if unordered |
FCMOVNE | Floating-point conditional move if not equal |
FCMOVNB | Floating-point conditional move if not below |
FCMOVNBE | Floating-point conditional move if not below or equal |
FCMOVNU | Floating-point conditional move if not unordered |
Basic Arithmetic Instructions
Instruction | Meaning |
---|---|
Integer Operands | |
FIADD | Add integer |
FISUB | Subtract integer |
FISUBR | Subtract integer reverse |
FIMUL | Multiply integer |
FIDIV | Divide integer |
FIDIVR | Divide integer reverse |
Floating-point Operands | |
FADD | Add floating-point |
FADDP | Add floating-point and pop |
FSUB | Subtract floating-point |
FSUBP | Subtract floating-point and pop |
FSUBR | Subtract floating-point reverse |
FSUBRP | Subtract floating-point reverse and pop |
FMUL | Multiply floating-point |
FMULP | Multiply floating-point and pop |
FDIV | Divide floating-point |
FDIVP | Divide floating-point and pop |
FDIVR | Divide floating-point reverse |
FDIVRP | Divide floating-point reverse and pop |
FPREM | Partial remainder |
FPREM1 | IEEE Partial remainder |
FRNDINT | Round to integer |
FABS | Absolute value |
FCHS | Change sign |
FSQRT | Square root |
FSCALE | Scale by power of two |
FXTRACT | Extract exponent and significant |
Transcendental Instructions
Instruction | Meaning |
---|---|
FSIN | Sine |
FCOS | Cosine |
FSINCOS | Sine and cosine |
FPTAN | Partial tangent |
FPATAN | Partial arctangent |
F2XM1 | 2x − 1 |
FYL2X | y * log2(x) |
FYL2XP1 | y * log2(x+1) |
Load Constants Instructions
Instruction | Meaning |
---|---|
FLDZ | Load +0.0 |
FLD1 | Load +1.0 |
FLDPI | Load Pi |
FLDL2E | Load log2(e) |
FLDLN2 | Load loge(2) |
FLDL2T | Load log2(10) |
FLDLG2 | Load log10(2) |
Comparison Instructions
Instruction | Meaning |
---|---|
Integer Operands | |
FICOM | Compare integer |
FICOMP | Compare integer and pop |
Floating-point Operands | |
FCOM | Compare floating-point |
FCOMP | Compare floating-point and pop |
FCOMPP | Compare floating-point and pop twice |
FCOMI | Compare floating-point and set EFLAGS |
FCOMIP | Compare floating-point, set EFLAGS, and pop |
FUCOM | Unordered compare floating-point |
FUCOMP | Unordered compare floating-point and pop |
FUCOMPP | Unordered compare floating-point and pop twice |
FUCOMI | Unordered compare floating-point and set EFLAGS |
FUCOMIP | Unordered compare floating-point, set EFLAGS, and pop |
FTST | Test floating-point (compare with 0.0) |
FXAM | Examine floating-point |
Control Instructions
Instruction | Meaning |
---|---|
FFREE | Free floating-point register |
FINCSTP | Increment FPU register stack pointer |
FDECSTP | Decrement FPU register stack pointer |
FINIT | Initialize FPU after checking error conditions |
FNINIT | Initialize FPU without checking error conditions |
FSTSW | Store FPU status word after checking error conditions |
FNSTSW | Store FPU status word without checking error conditions |
FCLEX | Clear floating-point exception flags after checking for error conditions |
FNCLEX | Clear floating-point exception flags without checking for error conditions |
FSTCW | Store FPU control word after checking error conditions |
FNSTCW | Store FPU control word without checking error conditions |
FLDCW | Load FPU control word |
FSAVE | Save FPU state after checking error conditions |
FNSAVE | Save FPU state without checking error conditions |
FRSTOR | Restore FPU state |
FSTENV | Store FPU environment after checking error conditions |
FNSTENV | Store FPU environment without checking error conditions |
FLDENV | Load FPU environment |
FNOP | FPU no operation |
FWAIT | Wait for FPU |
FPU and SIMD State Management Instructions
Instruction | Meaning |
---|---|
FXSAVE | Save x87 FPU and SIMD state |
FXRSTOR | Restore x87 FPU and SIMD state |