home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nasmide.zip / 8087HELP.HLP (.txt) < prev    next >
Borland Turbo Vision Help  |  1997-12-22  |  102KB  |  1,258 lines

  1. FBHF*
  2.  80x87 floating point opcode help
  3. Welcome to the NASM-IDE 1.1 online help. This section contains details on the Intel 80x87 floating point instruction set. 
  4.  Contents
  5.  Using
  6. opcode
  7. listings
  8.  Alphabetical
  9. opcode
  10. listing
  11.  Opcode
  12. listing
  13. minimum
  14. processor
  15. requirement
  16.  Using 80x87 floating point opcode help
  17. This help file contains entries for all 80x87 floating point instructions. Each entry contains the following sections: 
  18.  Description
  19. This contains a detailed description of how the instruction works. This information is based on the Intel Architecture Software Developer's Manual Volume 2, Instruction Set Reference (#243191), available from Intel's web site (http://www.intel.com/). 
  20. Please note that the notation ST(0)...ST(7) is used in the description to indicate the FPU registers. However, when coding in NASM, the FPU registers are represented by st0, st1...st7. 
  21.  Flags affected
  22. Describes any changes to the FPU flags as a result of the instruction being executed. 
  23.  Instruction timings
  24. Contains a table showing the number of clock cycles the instruction takes to executed. Timings are shown for the 8087 up to the Pentium processor. Instruction pairing information is also included for the Pentium timings. This information is taken from a HTML document available from http://www.quantasm.com/. 6
  25. The following symbols are used in the timing tables: 
  26.  Operands
  27.  reg   = floating point register, st0, st1 ... st7
  28.  mem   = memory address
  29.  mem32 = memory address of 32-bit item
  30.  mem64 = memory address of 64-bit item
  31.  mem80 = memory address of 80-bit item
  32.  FPU instruction timings
  33.  FX = pairs with FXCH
  34.  NP = no pairing
  35.  Timings with a hyphen indicate a range of possible timings
  36.  Timings with a slash (unless otherwise noted) are latency and throughput.
  37.  Latency is the time between instructions dependent on the result.
  38.  Throughput is the pipeline throughput between non conflicting instructions.
  39.  EA = cycles to calculate the Effective Address
  40.  FPU instruction sizing
  41. All FPU instructions that do not access memory are two bytes in length. (Except FWAIT which is one byte). o
  42. FPU instructions that access memory are four bytes for 16-bit addressing and six bytes for 32-bit addressing. 
  43. contents
  44. screen
  45.  80x87 floating point opcodes (alphabetical)
  46.  F2XM1                - Compute 2^x - 1
  47.  FABS                 - Absolute value
  48.  FADD/FADDP/FIADD     - Add
  49.  FBLD                 - Load binary coded decimal
  50.  FBSTP                - Store BCD integer and pop
  51.  FCHS                 - Change sign
  52.  FCLEX/FNCLEX         - Clear exceptions
  53.  FCMOVcc              - Floating point conditional move (Pentium Pro+)
  54.  FCOM/FCOMP/FCOMPP    - Compare real
  55.  FCOMI/FCOMIP/
  56.  FUCOMI/FUCOMPI       - Compare real and set EFLAGS (Pentium Pro+)
  57.  FCOS                 - Cosine (387+)
  58.  FDECSTP              - Decrement floating point stack pointer
  59.  FDISI/FNDISI         - Disable interrupts (8087 only)
  60.  FDIV/FDIVP/FIDIV     - Divide
  61.  FDIVR/FDIVRP/FIDIVR  - Reverse divide
  62.  FENI/FNENI           - Enable interrupts (8087 only)
  63.  FFREE                - Free floating point register
  64.  FICOM/FICOMP         - Compare integer
  65.  FILD                 - Load integer
  66.  FINCSTP              - Increment floating point stack pointer
  67.  FINIT/FNINIT         - Initialise floating point unit
  68.  FIST/FISTP           - Store integer
  69.  FLD                  - Load real
  70.  FLD1/FLDL2T/FLDL2E/
  71.  FLDPI/FLDLG2/
  72.  FLDLN2/FLDZ          - Load constant
  73.  FLDCW                - Load control word
  74.  FLDENV               - Load FPU environment
  75.  FMUL/FMULP/FIMUL     - Multiply
  76.  FNOP                 - No operation
  77.  FPATAN               - Partial arctangent
  78.  FPREM                - Partial remainder
  79.  FPREM1               - Partial remainder IEEE compatible (387+)
  80.  FPTAN                - Partial tangent
  81.  FRNDINT              - Round to integer
  82.  FRSTOR               - Restore FPU state
  83.  FSAVE/FNSAVE         - Store FPU state
  84.  FSCALE               - Scale
  85.  FSETPM               - Set protected mode (287 only)
  86.  FSIN                 - Sine (387+)
  87.  FSINCOS              - Sine and cosine (387+)
  88.  FSQRT                - Square root
  89.  FST/FSTP             - Store real
  90.  FSTCW/FNSTCW         - Store control word
  91.  FSTENV/FNSTENV       - Store FPU environment
  92.  FSTSW/FNSTSW         - Store status word
  93.  FSUB/FSUBP/FISUB     - Subtract
  94.  FSUBR/FSUBRP/FISUBR  - Reverse subtract
  95.  FTST                 - Test
  96.  FUCOM/FUCOMP/FUCOMPP - Unordered compare real (387+)
  97.  FWAIT                - Wait
  98.  FXAM                 - Examine
  99.  FXCH                 - Exchange register contents
  100.  FXTRACT              - Extract exponent and significand
  101.  FYL2X                - Compute y * log x (base 2)
  102.  FYL2XP1              - Compute y * log (base 2) (x + 1)
  103. contents
  104. screen
  105.  80x87 floating point opcodes (by processor)
  106.  8087 and above
  107.  F2XM1                - Compute 2^x - 1
  108.  FABS                 - Absolute value
  109.  FADD/FADDP/FIADD     - Add
  110.  FBLD                 - Load binary coded decimal
  111.  FBSTP                - Store BCD integer and pop
  112.  FCHS                 - Change sign
  113.  FCLEX/FNCLEX         - Clear exceptions
  114.  FCOM/FCOMP/FCOMPP    - Compare real
  115.  FDECSTP              - Decrement floating point stack pointer
  116.  FDISI/FNDISI         - Disable interrupts (8087 only)
  117.  FDIV/FDIVP/FIDIV     - Divide
  118.  FDIVR/FDIVRP/FIDIVR  - Reverse divide
  119.  FENI/FNENI           - Enable interrupts (8087 only)
  120.  FFREE                - Free floating point register
  121.  FICOM/FICOMP         - Compare integer
  122.  FILD                 - Load integer
  123.  FINCSTP              - Increment floating point stack pointer
  124.  FINIT/FNINIT         - Initialise floating point unit
  125.  FIST/FISTP           - Store integer
  126.  FLD                  - Load real
  127.  FLD1/FLDL2T/FLDL2E/
  128.  FLDPI/FLDLG2/
  129.  FLDLN2/FLDZ          - Load constant
  130.  FLDCW                - Load control word
  131.  FLDENV               - Load FPU environment
  132.  FMUL/FMULP/FIMUL     - Multiply
  133.  FNOP                 - No operation
  134.  FPATAN               - Partial arctangent
  135.  FPREM                - Partial remainder
  136.  FPTAN                - Partial tangent
  137.  FRNDINT              - Round to integer
  138.  FRSTOR               - Restore FPU state
  139.  FSAVE/FNSAVE         - Store FPU state
  140.  FSCALE               - Scale
  141.  FSQRT                - Square root
  142.  FST/FSTP             - Store real
  143.  FSTCW/FNSTCW         - Store control word
  144.  FSTENV/FNSTENV       - Store FPU environment
  145.  FSTSW/FNSTSW         - Store status word
  146.  FSUB/FSUBP/FISUB     - Subtract
  147.  FSUBR/FSUBRP/FISUBR  - Reverse subtract
  148.  FTST                 - Test
  149.  FWAIT                - Wait
  150.  FXAM                 - Examine
  151.  FXCH                 - Exchange register contents
  152.  FXTRACT              - Extract exponent and significand
  153.  FYL2X                - Compute y * log x (base 2)
  154.  FYL2XP1              - Compute y * log (base 2) (x + 1)
  155.  287 and above
  156.  FSETPM               - Set protected mode (287 only)
  157.  387 and above
  158.  FCOS                 - Cosine (387+)
  159.  FPREM1               - Partial remainder IEEE compatible (387+)
  160.  FSIN                 - Sine (387+)
  161.  FSINCOS              - Sine and cosine (387+)
  162.  FUCOM/FUCOMP/FUCOMPP - Unordered compare real (387+)
  163.  Pentium Pro and above
  164.  FCMOVcc              - Floating point conditional move (Pentium Pro+)
  165.  FCOMI/FCOMIP/
  166.  FUCOMI/FUCOMPI       - Compare real and set EFLAGS (Pentium Pro+)
  167. contents
  168. screen
  169.  F2XM1 - Compute 2^x - 1
  170.  Description
  171. Calculates the exponential value of 2 to the power of the source operand minus 1. The source operand is located in register ST(0) and the result is also stored in ST(0). The value of the source operand must lie in the range -1.0 to +1.0. If the source value is outside this range, the result is undefined. 
  172. The following table shows the results obtained when computing the exponential value of various classes of numbers, assuming that neither overflow nor underflow occurs. 
  173.           ST(0) SOURCE          ST(0) DESTINATION
  174.           -1.0 to -0            -0.5 to -0
  175.           -0                    -0
  176.           +0                    +0
  177.           +0 to +1.0            +0 to 1.0
  178.  Flags affected
  179.  C1                Set to 0 if stack underflow occurred.
  180.                   Indicates rounding direction if the inexact-result
  181.                   exception is generated: 0 = not roundup; 1 = roundup.
  182.  C0, C2, C3        Undefined.
  183.  Instruction timings
  184.    8087         287        387      486     Pentium
  185.  310-630      310-630    211-476  140-279   13-57   NP
  186. contents
  187. screen
  188.  FABS - Absolute value
  189.  Description
  190. Clears the sign bit of ST(0) to create the absolute value of the operand. The following table shows the results obtained when creating the absolute value of various classes of numbers. W
  191.          ST(0) SOURCE               ST(0) DESTINATION
  192.          -Infinity                  +Infinity
  193.          -F                         +F
  194.          -0                         +0
  195.          +0                         +0
  196.          +F                         +F
  197.          +Infinity                  +Infinity
  198.          NaN                        NaN
  199. NOTE: F Means finite-real number. '
  200.  Flags affected
  201.  C1                Set to 0 if stack underflow occurred;
  202.                    otherwise, cleared to 0.
  203.  C0, C2, C3        Undefined.
  204.  Instruction timings
  205.   8087         287        387      486     Pentium
  206.  10-17        10-17       22        3       1      FX
  207. contents
  208. screen
  209.  FADD/FADDP/FIADD - Add
  210.  Description
  211. Adds the destination and source operands and stores the sum in the destination location. The destination operand is always an FPU register; the source operand can be a register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. 
  212. The no-operand version of the instruction adds the contents of the ST(0) register to the ST(1) register. The one-operand version adds the contents of a memory location (either a real or an integer value) to the contents of the ST(0) register. The two-operand version, adds the contents of the ST(0) register to the ST(i) register or vice versa. The value in ST(0) can be doubled by coding: 
  213.         FADD st0, st0
  214. The FADDP instructions perform the additional operation of popping the FPU register stack after storing the result. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. (The no-operand version of the floating-point add instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FADD rather than FADDP.) r
  215. The FIADD instructions convert an integer source operand to extended-real format before performing the addition. 
  216. When the sum of two operands with opposite signs is 0, the result is +0, except for the round toward -infinity mode, in which case the result is -0. When the source operand is an integer 0, it is treated as a +0. 
  217. When both operand are infinities of the same sign, the result is infinity of the expected sign. If both operands are infinities of opposite signs, an invalid-operation exception is generated. '
  218.  Flags affected
  219.  C1               Set to 0 if stack underflow occurred.
  220.                   Indicates rounding direction if the
  221.                   inexact-result exception is generated:
  222.                   0 = not roundup; 1 = roundup.
  223.  C0, C2, C3       Undefined.
  224.  Instruction timings
  225.  variations/
  226.  operand       8087           287        387      486     Pentium
  227.  fadd         70-100         70-100     23-34     8-20    3/1     FX
  228.  fadd  mem32  90-120+EA      90-120     24-32     8-20    3/1     FX
  229.  fadd  mem64  95-125+EA      95-125     29-37     8-20    3/1     FX
  230.  faddp        75-105         75-105     23-31     8-20    3/1     FX
  231.  fiadd mem16  (102-137)+EA  102-137     71-85    20-35    7/4     NP
  232.  fiadd mem32  (108-143)+EA  108-143     57-72    19-32    7/4     NP
  233. contents
  234. screen
  235.  FBLD - Load binary coded decimal
  236.  Description
  237. Converts the BCD source operand into extended-real format and pushes the value onto the FPU stack. The source operand is loaded without rounding errors. The sign of the source operand is preserved, including that of -0. 
  238. The packed BCD digits are assumed to be in the range 0 through 9; the instruction does not check for invalid digits (AH through FH). Attempting to load an invalid encoding produces an undefined result. '
  239.  Flags affected
  240.  C1         Set to 1 if stack overflow occurred; otherwise,
  241.             cleared to 0.
  242.  C0, C2, C3 Undefined.
  243.  Instruction timings
  244.  operand      8087         287        387      486     Pentium
  245.  mem       (290-310)+EA  290-310    266-275   70-103   48-58   NP
  246. contents
  247. screen
  248.  FBSTP - Store BCD integer and pop
  249.  Description
  250. Converts the value in the ST(0) register to an 18-digit packed BCD integer, stores the result in the destination operand, and pops the register stack. If the source value is a non-integral value, it is rounded to an integer value, according to rounding mode specified by the RC field of the FPU control word. y
  251. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. 
  252. The destination operand specifies the address where the first byte destination value is to be stored. The BCD value (including its sign bit) requires 10 bytes of space in memory. n
  253. The following table shows the results obtained when storing various classes of numbers in packed BCD format. G
  254.            ST(0)             DESTINATION
  255.            -Infinity         *
  256.            -F < -1           -D
  257.            -1 < -F < -0      **
  258.            -0                -0
  259.            +0                +0
  260.            +0 < +F < +1      **
  261.            +F > +1           +D
  262.            +Infinity         *
  263.            NaN               *
  264. NOTES: F Means finite-real number. 
  265.        D Means packed-BCD number.
  266.        * Indicates floating-point invalid-operation exception.
  267.        ** 
  268. 0 or 
  269. 1, depending on the rounding mode.
  270. If the source value is too large for the destination format and the invalid-operation exception is not masked, an invalid-operation exception is generated and no value is stored in the destination operand. If the invalid-operation exception is masked, the packed BCD indefinite value is stored in memory. 
  271. If the source value is a quiet NaN, an invalid-operation exception is generated. Quiet NaNs do not normally cause this exception to be generated. '
  272.  Flags affected
  273. C1                Set to 0 if stack underflow occurred. 
  274.                   Indicates rounding direction if the inexact
  275.                   exception is generated: 0 = not roundup;
  276.                   1 = roundup.
  277. C0, C2, C3        Undefined. 1
  278.  Instruction timings
  279.     8087         287        387      486     Pentium
  280.  (520-540)+EA  520-540    512-534  172-176   148-154 NP
  281. contents
  282. screen
  283.  FCHS - Change sign
  284.  Description
  285. Complements the sign bit of ST(0). This operation changes a positive value into a negative value of equal magnitude or vice versa. The following table shows the results obtained when changing the sign of various classes of numbers. w
  286.                 ST(0) SOURCE            ST(0) DESTINATION
  287.                 -Infinity               +Infinity
  288.                 -F                      +F
  289.                 -0                      +0
  290.                 +0                      -0
  291.                 +F                      -F
  292.                 +Infinity               -Infinity
  293.                 NaN                     NaN
  294. NOTE: F Means finite-real number. '
  295.  Flags affected
  296. C1                Set to 0 if stack underflow occurred; otherwise,  
  297.                   cleared to 0.
  298. C0, C2, C3        Undefined. 1
  299.  Instruction timings
  300.   8087         287        387      486     Pentium
  301.  10-17        10-17      24-25      6       1      FX
  302. contents
  303. screen
  304.  FCLEX/FNCLEX - Clear exceptions
  305.  Description
  306. Clears the floating-point exception flags (PE, UE, OE, ZE, DE, and IE), the exception summary status flag (ES), the stack fault flag (SF), and the busy flag (B) in the FPU status word. The FCLEX instruction checks for and handles any pending unmasked floating-point exceptions before clearing the exception flags; the FNCLEX instruction does not. 1
  307. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNCLEX instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNCLEX instruction cannot be interrupted in this way on a Pentium Pro processor. '
  308.  Flags affected
  309. The PE, UE, OE, ZE, DE, IE, ES, SF, and B flags in the FPU status word are cleared. The C0, C1, C2, and C3 flags are undefined. 1
  310.  Instruction timings
  311.  variations    8087         287        387      486     Pentium
  312.  fclex         2-8          2-8        11        7       9      NP
  313.  fnclex        2-8          2-8        11        7       9      NP
  314.  The wait version (FCLEX) may take additional cycles
  315. contents
  316. screen
  317.  FCMOVcc - Floating point conditional move (Pentium Pro+)
  318.  Description
  319. Tests the status flags in the EFLAGS register and moves the source operand (second operand) to the destination operand (first operand) if the given test condition is true. The conditions for each mnemonic are given in the shown below. %
  320.  Instruction            Description
  321.  FCMOVB                 Move if below (CF=1)
  322.  FCMOVE                 Move if equal (ZF=1)
  323.  FCMOVBE                Move if below or equal (CF=1 or ZF=1)
  324.  FCMOVU                 Move if unordered (PF=1)
  325.  FCMOVNB                Move if not below (CF=0)
  326.  FCMOVNE                Move if not equal (ZF=0)
  327.  FCMOVNBE               Move if not below or equal (CF=0 and ZF=0)
  328.  FCMOVNU                Move if not unordered (PF=0)
  329. The source operand is always in the ST(i) register and the destination operand is always ST(0). 
  330. The FCMOVcc instructions are useful for optimizing small IF constructions. They also help eliminate branching overhead for IF operations and the possibility of branch mispredictions by the processor. G
  331. A processor may not support the FCMOVcc instructions. Software can check if the FCMOVcc instructions are supported by checking the processor's feature information with the CPUID instruction (see Help
  332. Integer Opcodes for more information). If both the CMOV and FPU feature bits are set, the FCMOVcc instructions are supported. 
  333. The FCMOVcc instructions were introduced to the Intel Architecture in the Pentium Pro processor family and is not available in earlier processors. '
  334.  Flags affected
  335.  C1                Set to 0 if stack underflow occurred.
  336.  C0, C2, C3        Undefined.
  337.  Instruction timings
  338. Not available. 
  339. contents
  340. screen
  341.  FCOM/FCOMP/FCOMPP - Compare real
  342.  Description
  343. Compares the contents of register ST(0) and source value and sets condition code flags C0, C2, and C3 in the FPU status word according to the results (see the table below). The source operand can be a data register or a memory location. If no source operand is given, the value in ST(0) is compared with the value in ST(1). The sign of zero is ignored, so that -0.0 = +0.0. 
  344.     Condition       C3       C2      C0
  345.     ST(0) > SRC     0        0       0
  346.     ST(0) < SRC     0        0       1
  347.     ST(0) = SRC     1        0       0
  348.     Unordered*      1        1       1
  349. NOTE: * Flags not set if unmasked invalid-arithmetic-operand exception is 
  350.         generated.
  351. This instruction checks the class of the numbers being compared (see FXAM). If either operand is a NaN or is in an unsupported format, an invalid-arithmetic-operand exception is raised and, if the exception is masked, the condition flags are set to "unordered." If the invalid-arithmetic-operand exception is unmasked, the condition code flags are not set. '
  352. The FCOMP instruction pops the register stack following the comparison operation and the FCOMPP instruction pops the register stack twice following the comparison operation. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. 
  353. The FCOM instructions perform the same operation as the FUCOM instructions. The only difference is how they handle QNaN operands. The FCOM instructions raise an invalid-arithmetic- operand exception when either or both of the operands is a NaN value or is in an unsupported format. The FUCOM instructions perform the same operation as the FCOM instructions, except that they do not generate an invalid-arithmetic-operand exception for QNaNs. '
  354.  Flags affected
  355.  C1                Set to 0 if stack underflow occurred;
  356.                    otherwise, cleared to 0.
  357.  C0, C2, C3        See table above.
  358.  Instruction timings
  359.  variations/
  360.  operand      8087         287        387      486     Pentium
  361.  fcom reg     40-50        40-50       24        4      4/1     FX
  362.  fcom mem32  (60-70)+EA    60-70       26        4      4/1     FX
  363.  fcom mem64  (65-75)+EA    65-75       31        4      4/1     FX
  364.  fcomp        42-52        42-52       26        4      4/1     FX
  365.  fcompp       45-55        45-55       26        5      4/1     FX
  366. contents
  367. screen
  368.  FCOMI/FCOMIP/FUCOMI/FUCOMPI - Compare real and set EFLAGS (Pentium Pro+)
  369.  Description
  370. Compares the contents of register ST(0) and ST(i) and sets the status flags ZF, PF, and CF in the EFLAGS register according to the results (see the table below). The sign of zero is ignored for comparisons, so that -0.0 = +0.0. 
  371.    Comparison Results    ZF    PF   CF
  372.    ST0 > ST(i)           0     0    0
  373.    ST0 < ST(i)           0     0    1
  374.    ST0 = ST(i)           1     0    0
  375.    Unordered*            1     1    1
  376.  NOTE: * Flags not set if unmasked invalid-arithmetic-operand exception is
  377.          generated.
  378. The FCOMI/FCOMIP instructions perform the same operation as the FUCOMI/FUCOMIP instructions. The only difference is how they handle QNaN operands. The FCOMI/FCOMIP instructions set the status flags to "unordered" and generate an invalid-arithmetic-operand exception when either or both of the operands is a NaN value (SNaN or QNaN) or is in an unsupported format. 
  379. The FUCOMI/FUCOMIP instructions perform the same operation as the FCOMI/FCOMIP instructions, except that they do not generate an invalid-arithmetic-operand exception for QNaNs. See FXAM for additional information on unordered comparisons. 
  380. If invalid-operation exception is unmasked, the status flags are not set if the invalid-arithmetic-operand exception is generated. 
  381. The FCOMIP and FUCOMIP instructions also pop the register stack following the comparison operation. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. 
  382. The FCOMI/FCOMIP/FUCOMI/FUCOMIP instructions were introduced in the Pentium Pro processor family and are not available in earlier processors. '
  383.  Flags affected
  384.  C1                Set to 0 if stack underflow occurred;
  385.                    otherwise, cleared to 0.
  386.  C0, C2, C3        Not affected.
  387.  Instruction timings
  388. Not available. 
  389. contents
  390. screen
  391.  FCOS - Cosine (387+)
  392.  Description
  393. Calculates the cosine of the source operand in register ST(0) and stores the result in ST(0). The source operand must be given in radians and must be within the range -2^63 to +2^63 . The following table shows the results obtained when taking the cosine of various classes of numbers, assuming that neither overflow nor underflow occurs. c
  394.                  ST(0) SOURCE         ST(0) DESTINATION
  395.                  -Infinity            *
  396.                  -F                   -1 to +1
  397.                  -0                   +1
  398.                  +0                   +1
  399.                  +F                   -1 to +1
  400.                  +Infinity            *
  401.                  NaN                  NaN
  402. NOTES: F Means finite-real number. H
  403.        * Indicates floating-point invalid-arithmetic-operand exception.
  404. If the source operand is outside the acceptable range, the C2 flag in the FPU status word is set, and the value in register ST(0) remains unchanged. The instruction does not raise an exception when the source operand is out of range. It is up to the program to check the C2 flag for out-of-range conditions. Source values outside the range -2^63 to +2^63 can be reduced to the range of the instruction by subtracting an appropriate integer multiple of 2PI or by using the FPREM instruction with a divisor of 2PI. '
  405.  Flags affected
  406.  C1               Set to 0 if stack underflow occurred.
  407.                   Indicates rounding direction if the
  408.                   inexact-result exception is generated:
  409.                   0 = not roundup; 1 = roundup.
  410.                   Undefined if C2 is 1.
  411.  C2               Set to 1 if source operand is outside
  412.                   the range -2^63 to +2^63 ; otherwise,
  413.                   cleared to 0.
  414.  C0, C3           Undefined.
  415.  Instruction timings
  416.  8087         287        387      486     Pentium
  417.   -            -       123-772  257-354   18-124  NP
  418.   Additional cycles required if operand > pi / 4 (~3.141/4 = ~.785)
  419. contents
  420. screen
  421.  FDECSTP - Decrement floating point stack pointer
  422.  Description
  423. Subtracts one from the TOP field of the FPU status word (decrements the top-of-stack pointer). If the TOP field contains a 0, it is set to 7. The effect of this instruction is to rotate the stack by one position. The contents of the FPU data registers and tag register are not affected. '
  424.  Flags affected
  425. The C1 flag is set to 0; otherwise, cleared to 0. The C0, C2, and C3 flags are undefined. 1
  426.  Instruction timings
  427.  8087         287        387      486     Pentium
  428.  6-12         6-12       22        3       1      NP
  429. contents
  430. screen
  431.  FDISI/FNDISI - Disable interrupts (8087 only)
  432.  Description
  433. This instruction is only supported by the 8087 FPU, all subsequent processors perform an FNOP instruction. '
  434.  Flags affected
  435. Not available. 1
  436.  Instruction timings
  437.  variations    8087         287        387      486     Pentium
  438.  fdisi         2-8           2          2        3       1      NP
  439.  fndisi        2-8           2          2        3       1      NP
  440.  Note: The wait version (FDISI) may take additional cycles
  441. contents
  442. screen
  443.  FDIV/FDIVP/FIDIV - Divide
  444.  Description
  445. Divides the destination operand by the source operand and stores the result in the destination location. The destination operand (dividend) is always in an FPU register; the source operand (divisor) can be a register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. 
  446. The no-operand version of the instruction divides the contents of the ST(1) register by the contents of the ST(0) register. The one-operand version divides the contents of the ST(0) register by the contents of a memory location (either a real or an integer value). The two-operand version, divides the contents of the ST(0) register by the contents of the ST(i) register or vice versa. 
  447. The FDIVP instructions perform the additional operation of popping the FPU register stack after storing the result. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The no-operand version of the floating-point divide instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FDIV rather than FDIVP. 
  448. The FIDIV instructions convert an integer source operand to extended-real format before performing the division. When the source operand is an integer 0, it is treated as a +0. 
  449. If an unmasked divide by zero exception is generated, no result is stored; if the exception is masked, an infinity of the appropriate sign is stored in the destination operand. '
  450.  Flags affected
  451.  C1                Set to 0 if stack underflow occurred.
  452.                    Indicates rounding direction if the
  453.                    inexact-result exception is generated:
  454.                    0 = not roundup; 1 = roundup.
  455.  C0, C2, C3        Undefined.
  456.  Instruction timings
  457.  variations/
  458.  operand         8087         287        387      46     Pentiu/m
  459.  fdiv reg      193-203      193-203     88-91     73      39      FX
  460.  fdiv mem32   (215-225)+EA  215-225      89       73      39      FX
  461.  fdiv mem64   (220-230)+EA  220-230      94       73      39      FX
  462.  fdivp         197-207      197-207      91       73      39      FX
  463.  fidiv mem16  (224-238)+EA  224-238    136-140   85-89    42      NP
  464.  fidiv mem32  (230-243)+EA  230-243    120-127   84-86    42      NP
  465. contents
  466. screen
  467.  FDIVR/FDIVRP/FIDIVR - Reverse divide
  468.  Description
  469. Divides the source operand by the destination operand and stores the result in the destination location. The destination operand (divisor) is always in an FPU register; the source operand (dividend) can be a register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. 
  470. These instructions perform the reverse operations of the FDIV, FDIVP, and FIDIV instructions. They are provided to support more efficient coding. 
  471. The no-operand version of the instruction divides the contents of the ST(0) register by the contents of the ST(1) register. The one-operand version divides the contents of a memory loca-tion (either a real or an integer value) by the contents of the ST(0) register. The two-operand version, divides the contents of the ST(i) register by the contents of the ST(0) register or vice versa. 
  472. The FDIVRP instructions perform the additional operation of popping the FPU register stack after storing the result. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The no-operand version of the floating-point divide instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FDIVR rather than FDIVRP. s
  473. The FIDIVR instructions convert an integer source operand to extended-real format before performing the division. 
  474. If an unmasked divide by zero exception is generated, no result is stored; if the exception is masked, an infinity of the appropriate sign is stored in the destination operand. '
  475.  Flags affected
  476.  C1                Set to 0 if stack underflow occurred.
  477.                    Indicates rounding direction if the
  478.                    inexact-result exception is generated:
  479.                    0 = not roundup; 1 = roundup.
  480.  C0, C2, C3        Undefined.
  481.  Instruction timings
  482.  variations/
  483.  operand          8087         287        387      486     Pentium
  484.  fdivr reg      194-204      194-204     88-91     73      39      FX
  485.  fdivr mem32   (216-226)+EA  216-226      89       73      39      FX
  486.  fdivr mem64   (221-231)+EA  221-231      94       73      39      FX
  487.  fdivrp         198-208      198-208      91       73      39      FX
  488.  fidivr mem16  (225-239)+EA  225-239    135-141   85-89    42      NP
  489.  fidivr mem32  (231-245)+EA  231-245    121-128   84-86    42      NP
  490. contents
  491. screen
  492.  FENI/FNENI - Enable interrupts (8087 only)
  493.  Description
  494. This instruction is only supported by the 8087 FPU, all subsequent processors perform an FNOP instruction. '
  495.  Flags affected
  496. Not available. 1
  497.  Instruction timings
  498.  variations    8087         287        387      486     Pentium
  499.  feni          2-8           2          2        3       1      NP
  500.  fneni         2-8           2          2        3       1      NP
  501. contents
  502. screen
  503.  FFREE - Free floating point register
  504.  Description
  505. Sets the tag in the FPU tag register associated with register ST(i) to empty (11B). The contents of ST(i) and the FPU stack-top pointer (TOP) are not affected. '
  506.  Flags affected
  507. C0, C1, C2, C3 undefined. 1
  508.  Instruction timings
  509.  8087         287        387      486     Pentium
  510.  9-16         9-16       18        3       1      NP
  511. contents
  512. screen
  513.  FICOM/FICOMP - Compare integer
  514.  Description
  515. Compares the value in ST(0) with an integer source operand and sets the condition code flags C0, C2, and C3 in the FPU status word according to the results (see table below). The integer value is converted to extended-real format before the comparison is made. 
  516.  Condition                   C3      C2      C0
  517.  ST(0) > SRC                 0       0       0
  518.  ST(0) < SRC                 0       0       1
  519.  ST(0) = SRC                 1       0       0
  520.  Unordered                   1       1       1
  521. These instructions perform an "unordered comparison." An unordered comparison also checks the class of the numbers being compared (see FXAM). If either operand is a NaN or is in an undefined format, the condition flags are set to "unordered." 3
  522. The sign of zero is ignored, so that -0.0 = +0.0. 
  523. The FICOMP instructions pop the register stack following the comparison. To pop the register stack, the processor marks the ST(0) register empty and increments the stack pointer (TOP) by 1. '
  524.  Flags affected
  525.  C1                Set to 0 if stack underflow occurred;
  526.                    otherwise, set to 0.
  527.  C0, C2, C3        See table above.
  528.  Instruction timings
  529.  variations/
  530.  operand        8087         287        387      486     Pentium
  531.  ficom  mem16  (72-86)+EA   72-86      71-75    16-20    8/4     NP
  532.  ficom  mem32  (78-91)+EA   78-91      56-63    15-17    8/4     NP
  533.  ficomp mem16  (74-88)+EA   74-88      71-75    16-20    8/4     NP
  534.  ficomp mem32  (80-93)+EA   80-93      56-63    15-17    8/4     NP
  535. contents
  536. screen
  537.  FILD - Load integer
  538.  Description
  539. Converts the signed-integer source operand into extended-real format and pushes the value onto the FPU register stack. The source operand can be a word, short, or long integer value. It is loaded without rounding errors. The sign of the source operand is preserved. '
  540.  Flags affected
  541.  C1                Set to 1 if stack overflow occurred;
  542.                    cleared to 0 otherwise.
  543.  C0, C2, C3        Undefined.
  544.  Instruction timings
  545.  operand      8087         287        387      486     Pentium
  546.  mem16      (46-54)+EA    46-54      61-65    13-16    3/1     NP
  547.  mem32      (52-60)+EA    52-60      45-52     9-12    3/1     NP
  548.  mem64      (60-68)+EA    60-68      56-67    10-18    3/1     NP
  549. contents
  550. screen
  551.  FINCSTP - Increment floating point stack pointer
  552.  Description
  553. Adds one to the TOP field of the FPU status word (increments the top-of-stack pointer). If the TOP field contains a 7, it is set to 0. The effect of this instruction is to rotate the stack by one position. The contents of the FPU data registers and tag register are not affected. This operation is not equivalent to popping the stack, because the tag for the previous top-of-stack register is not marked empty. '
  554.  Flags affected
  555. The C1 flag is set to 0; otherwise, cleared to 0. The C0, C2, and C3 flags are undefined. 1
  556.  Instruction timings
  557.  8087         287        387      486     Pentium
  558.  6-12         6-12       21        3       1      NP
  559. contents
  560. screen
  561.  FINIT/FNINIT - Initialise floating point unit
  562.  Description
  563. Sets the FPU control, status, tag, instruction pointer, and data pointer registers to their default states. The FPU control word is set to 037FH (round to nearest, all exceptions masked, 64-bit precision). The status word is cleared (no exception flags set, TOP is set to 0). The data registers in the register stack are left unchanged, but they are all tagged as empty (11B). Both the instruction and data pointers are cleared. 
  564. The FINIT instruction checks for and handles any pending unmasked floating-point exceptions before performing the initialization; the FNINIT instruction does not. 1
  565. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNINIT instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNINIT instruction cannot be interrupted in this way on a Pentium Pro processor. n
  566. In the 387 maths coprocessor, the FINIT/FNINIT instruction does not clear the instruction and data pointers. '
  567.  Flags affected
  568.  C0, C1, C2, C3 cleared to 0.
  569.  Instruction timings
  570.  variations    8087         287        387      486     Pentium
  571.  finit         2-8          2-8        33       17      16      NP
  572.  fninit        2-8          2-8        33       17      12      NP
  573.  Note: The wait version (FINIT) may take additional cycles
  574. contents
  575. screen
  576.  FIST/FISTP - Store integer
  577.  Description
  578. The FIST instruction converts the value in the ST(0) register to a signed integer and stores the result in the destination operand. Values can be stored in word- or short-integer format. The destination operand specifies the address where the first byte of the destination value is to be stored. *
  579. The FISTP instruction performs the same operation as the FIST instruction and then pops the register stack. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The FISTP instruction can also stores values in long-integer format. k
  580. The following table shows the results obtained when storing various classes of numbers in integer format. E
  581.       ST(0)                  DESTINATION
  582.       -Infinity              *
  583.       -F < -1                -I
  584.       -1 < -F < -0           **
  585.       -0                     0
  586.       +0                     0
  587.       +0 < +F < +1           **
  588.       +F > +1                +I
  589.       +Infinity              *
  590.       NaN                    *
  591. NOTES: F  Means finite-real number. 
  592.        I  Means integer.
  593.        *  Indicates floating-point invalid-operation (#IA) exception.
  594.        ** 0 or 
  595. 1, depending on the rounding mode.
  596. If the source value is a non-integral value, it is rounded to an integer value, according to the rounding mode specified by the RC field of the FPU control word. 
  597. If the value being stored is too large for the destination format, is an infinity, is a NaN, or is in an unsupported format and if the invalid-arithmetic-operand exception is unmasked, an invalid-operation exception is generated and no value is stored in the destination operand. If the invalid-operation exception is masked, the integer indefinite value is stored in the destination operand. '
  598.  Flags affected
  599.  C1                Set to 0 if stack underflow occurred.
  600.                    Indicates rounding direction of if the
  601.                    inexact exception is generated:
  602.                    0 = not roundup; 1 = roundup.
  603.                    Cleared to 0 otherwise.
  604.  C0, C2, C3        Undefined.
  605.  Instruction timings
  606.  variations/
  607.  operand       8087         287        387      486     Pentium
  608.  fist  mem16  (80-90)+EA   80-90      82-95    29-34     6      NP
  609.  fist  mem32  (82-92)+EA   82-92      79-93    28-34     6      NP
  610.  fistp mem16  (82-92)+EA   82-92      82-95    29-34     6      NP
  611.  fistp mem32  (84-94)+EA   84-94      79-93    28-34     6      NP
  612.  fistp mem64  (94-105)+EA  94-105     80-97    28-34     6      NP
  613. contents
  614. screen
  615.  FLD - Load real
  616.  Description
  617. Pushes the source operand onto the FPU register stack. If the source operand is in single- or double-real format, it is automatically converted to the extended-real format before being pushed on the stack. 
  618. The FLD instruction can also push the value in a selected FPU register [ST(i)] onto the stack. Here, pushing register ST(0) duplicates the stack top. '
  619.  Flags affected
  620.  C1                Set to 1 if stack overflow occurred;
  621.                    otherwise, cleared to 0.
  622.  C0, C2, C3        Undefined.
  623.  Instruction timings
  624.  operand       8087         287        387      486     Pentium
  625.  reg          17-22        17-22       14        4       1      FX
  626.  mem32       (38-56)+EA    38-56       20        3       1      FX
  627.  mem64       (40-60)+EA    40-60       25        3       1      FX
  628.  mem80       (53-65)+EA    53-65       44        6       3      NP
  629. contents
  630. screen
  631.  FLD1/FLDL2T/FLDL2E/FLDPI/FLDLG2/FLDLN2/FLDZ - Load constant
  632.  Description
  633. Push one of seven commonly used constants (in extended-real format) onto the FPU register stack. The constants that can be loaded with these instructions are shown below: 
  634.  Instruction            Description
  635.  FLD1                   Push +1.0 onto the FPU register stack.
  636.  FLDL2T                 Push log (base 2) 10 onto the FPU register stack.
  637.  FLDL2E                 Push log (base 2) e onto the FPU register stack.
  638.  FLDPI                  Push pi onto the FPU register stack.
  639.  FLDLG2                 Push log (base 10) 2 onto the FPU register stack.
  640.  FLDLN2                 Push log (base e) 2 onto the FPU register stack.
  641.  FLDZ                   Push +0.0 onto the FPU register stack.
  642. For each constant, an internal 66-bit constant is rounded (as specified by the RC field in the FPU control word) to external-real format. The inexact-result exception is not generated as a result of the rounding. '
  643.  Flags affected
  644.  C1                Set to 1 if stack overflow occurred;
  645.                    otherwise, cleared to 0.
  646.  C0, C2, C3        Undefined.
  647.  Instruction timings
  648.  variations    8087         287        387      486     Pentium
  649.  fldz         11-17        11-17       20        4       2      NP
  650.  fld1         15-21        15-21       24        4       2      NP
  651.  fldl2e       15-21        15-21       40        8      5/3     NP
  652.  fldl2t       16-22        16-22       40        8      5/3     NP
  653.  fldlg2       18-24        18-24       41        8      5/3     NP
  654.  fldln2       17-23        17-23       41        8      5/3     NP
  655.  fldpi        16-22        16-22       40        8      5/3     NP
  656. contents
  657. screen
  658.  FLDCW - Load control word
  659.  Description
  660. Loads the 16-bit source operand into the FPU control word. The source operand is a memory location. This instruction is typically used to establish or change the FPU's mode of operation. 
  661. If one or more exception flags are set in the FPU status word prior to loading a new FPU control word and the new control word unmasks one or more of those exceptions, a floating-point exception will be generated upon execution of the next floating-point instruction (except for the no-wait floating-point instructions). To avoid raising exceptions when changing FPU operating modes, clear any pending exceptions (using the FCLEX or FNCLEX instruction) before loading the new control word. '
  662.  Flags affected
  663. C0, C1, C2, C3 undefined. 1
  664.  Instruction timings
  665.  operand     8087         287        387      486     Pentium
  666.  mem16      (7-14)+EA     7-14       19        4       7      NP
  667. contents
  668. screen
  669.  FLDENV - Load FPU environment
  670.  Description
  671. Loads the complete FPU operating environment from memory into the FPU registers. The source operand specifies the first byte of the operating-environment data in memory. This data is typically written to the specified memory location by a FSTENV or FNSTENV instruction. 
  672. The FPU operating environment consists of the FPU control word, status word, tag word, instruction pointer, data pointer, and last opcode. w
  673. The FLDENV instruction should be executed in the same operating mode as the corresponding FSTENV/FNSTENV instruction. 
  674. If one or more unmasked exception flags are set in the new FPU status word, a floating-point exception will be generated upon execution of the next floating-point instruction (except for the no-wait floating-point instructions). 
  675. To avoid generating exceptions when loading a new environment, clear all the exception flags in the FPU status word that is being loaded. '
  676.  Flags affected
  677. The C0, C1, C2, C3 flags are loaded. 1
  678.  Instruction timings
  679.  operand   8087         287        387      486     Pentium
  680.  mem     (35-45)+EA    35-45       71      44/34    37/32-33 NP
  681.  NOTE: cycles for real mode/protected mode
  682. contents
  683. screen
  684.  FMUL/FMULP/FIMUL - Multiply
  685.  Description
  686. Multiplies the destination and source operands and stores the product in the destination location. The destination operand is always an FPU data register; the source operand can be an FPU data register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. P
  687. The no-operand version of the instruction multiplies the contents of the ST(1) register by the contents of the ST(0) register and stores the product in the ST(1) register. The one-operand version multiplies the contents of the ST(0) register by the contents of a memory location (either a real or an integer value) and stores the product in the ST(0) register. The two-operand version, multiplies the contents of the ST(0) register by the contents of the ST(i) register, or vice versa, with the result being stored in the register specified with the first operand (the destination operand). 
  688. The FMULP instructions perform the additional operation of popping the FPU register stack after storing the product. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The no-operand version of the floating-point multiply instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FMUL rather than FMULP. x
  689. The FIMUL instructions convert an integer source operand to extended-real format before performing the multiplication. 
  690. The sign of the result is always the exclusive-OR of the source signs, even if one or more of the values being multiplied is 0 or infinity. When the source operand is an integer 0, it is treated as a +0. '
  691.  Flags affected
  692.  C1                Set to 0 if stack underflow occurred.
  693.                    Indicates rounding direction if the
  694.                    inexact-result exception fault is
  695.                    generated: 0 = not roundup; 1 = roundup.
  696.  C0, C2, C3        Undefined.
  697.  Instruction timings
  698.  variations/
  699.  operand         8087         287        387      486     Pentium
  700.  fmul reg s      90-105       90-105    29-52     16      3/1     FX
  701.  fmul reg       130-145      130-145    46-57     16      3/1     FX
  702.  fmul mem32    (110-125)+EA  110-125    27-35     11      3/1     FX
  703.  fmul mem64    (154-168)+EA  154-168    32-57     14      3/1     FX
  704.  fmulp reg s     94-108       94-108    29-52     16      3/1     FX
  705.  fmulp reg      134-148      134-148    29-57     16      3/1     FX
  706.  fimul mem16   (124-138)+EA  124-138    76-87    23-27    7/4     NP
  707.  fimul mem32   (130-144)+EA  130-144    61-82    22-24    7/4     NP
  708.  Note: s = register with 40 trailing zeros in fraction
  709. contents
  710. screen
  711.  FNOP - No operation
  712.  Description
  713. Performs no FPU operation. This instruction takes up space in the instruction stream but does not affect the FPU or machine context, except the EIP register. '
  714.  Flags affected
  715. C0, C1, C2, C3 undefined. 1
  716.  Instruction timings
  717.   8087         287        387      486     Pentium
  718.  10-16        10-16       12        3       1      NP
  719. contents
  720. screen
  721.  FPATAN - Partial arctangent
  722.  Description
  723. Computes the arctangent of the source operand in register ST(1) divided by the source operand in register ST(0), stores the result in ST(1), and pops the FPU register stack. The result in register ST(0) has the same sign as the source operand ST(1) and a magnitude less than +pi 
  724. The FPATAN instruction returns the angle between the X axis and the line from the origin to the point (X,Y), where Y (the ordinate) is ST(1) and X (the abscissa) is ST(0). The angle depends on the sign of X and Y independently, not just on the sign of the ratio Y/X. This is because a point (-X,Y) is in the second quadrant, resulting in an angle between pi/2 and pi, while a point (X,-Y) is in the fourth quadrant, resulting in an angle between 0 and -pi/2. A point (-X,-Y) is in the third quadrant, giving an angle between -pi/2 and -pi. Q
  725. There is no restriction on the range of source operands that FPATAN can accept. p
  726. The source operands for this instruction are restricted for the 80287 math coprocessor to the following range: %
  727.  0 <= |ST(1)| < |ST(0)| < +Infinity
  728.  Flags affected
  729.  C1               Set to 0 if stack underflow occurred.
  730.                   Indicates rounding direction if the
  731.                   inexact-result exception is generated:
  732.                   0 = not roundup; 1 = roundup.
  733.  C0, C2, C3       Undefined.
  734.  Instruction timings
  735.   8087         287        387      486     Pentium
  736.  250-800      250-800    314-487  218-303   17-173
  737. contents
  738. screen
  739.  FPREM - Partial remainder
  740.  Description
  741. Computes the remainder obtained from dividing the value in the ST(0) register (the dividend) by the value in the ST(1) register (the divisor or modulus), and stores the result in ST(0). The remainder represents the following value: "
  742.  Remainder = ST(0) - (Q * ST(1))
  743. Here, Q is an integer value that is obtained by truncating the real-number quotient of [ST(0) / ST(1)] toward zero. The sign of the remainder is the same as the sign of the dividend. The magnitude of the remainder is less than that of the modulus, unless a partial remainder was computed (as described below). 
  744. This instruction produces an exact result; the precision (inexact) exception does not occur and the rounding control has no effect. 
  745. When the result is 0, its sign is the same as that of the dividend. When the modulus is infinity, the result is equal to the value in ST(0). 
  746. The FPREM instruction does not compute the remainder specified in IEEE Std 754. The IEEE specified remainder can be computed with the FPREM1 instruction. The FPREM instruction is provided for compatibility with the Intel 8087 and Intel287 math coprocessors. 
  747. The FPREM instruction gets its name "partial remainder" because of the way it computes the remainder. This instructions arrives at a remainder through iterative subtraction. It can, however, reduce the exponent of ST(0) by no more than 63 in one execution of the instruction. If the instruction succeeds in producing a remainder that is less than the modulus, the operation is complete and the C2 flag in the FPU status word is cleared. Otherwise, C2 is set, and the result in ST(0) is called the partial remainder. The exponent of the partial remainder will be less than the exponent of the original dividend by at least 32. Software can re-execute the instruction (using the partial remainder in ST(0) as the dividend) until C2 is cleared. (Note that while executing such a remainder-computation loop, a higher-priority interrupting routine that needs the FPU can force a context switch in-between the instructions in the loop.) 
  748. An important use of the FPREM instruction is to reduce the arguments of periodic functions. When reduction is complete, the instruction stores the three least-significant bits of the quotient in the C3, C1, and C0 flags of the FPU status word. This information is important in argument reduction for the tangent function (using a modulus of pi/4), because it locates the original angle in the correct one of eight sectors of the unit circle. '
  749.  Flags affected
  750.  C0    Set to bit 2 (Q2) of the quotient.
  751.  C1    Set to 0 if stack underflow occurred;
  752.        otherwise, set to least significant bit
  753.        of quotient (Q0).
  754.  C2    Set to 0 if reduction complete; set to
  755.        1 if incomplete.
  756.  C3    Set to bit 1 (Q1) of the quotient.
  757.  Instruction timings
  758.   8087         287        387      486     Pentium
  759.  15-190       15-190     74-155   70-138   16-64   NP
  760. contents
  761. screen
  762.  FPREM1 - Partial remainder IEEE compatible (387+)
  763.  Description
  764. Computes the IEEE remainder obtained from dividing the value in the ST(0) register (the dividend) by the value in the ST(1) register (the divisor or modulus), and stores the result in ST(0). The remainder represents the following value: "
  765.  Remainder = ST(0) - (Q * ST(1))
  766. Here, Q is an integer value that is obtained by rounding the real-number quotient of [ST(0) / ST(1)] toward the nearest integer value. The magnitude of the remainder is less than half the magnitude of the modulus, unless a partial remainder was computed (as described below). 
  767. This instruction produces an exact result; the precision (inexact) exception does not occur and the rounding control has no effect. 
  768. When the result is 0, its sign is the same as that of the dividend. When the modulus is infinity, the result is equal to the value in ST(0). 
  769. The FPREM1 instruction computes the remainder specified in IEEE Std 754. This instruction operates differently from the FPREM instruction in the way that it rounds the quotient of ST(0) divided by ST(1) to an integer. S
  770. Like the FPREM instruction, the FPREM1 computes the remainder through iterative subtraction, but can reduce the exponent of ST(0) by no more than 63 in one execution of the instruction. If the instruction succeeds in producing a remainder that is less than one half the modulus, the operation is complete and the C2 flag in the FPU status word is cleared. Otherwise, C2 is set, and the result in ST(0) is called the partial remainder. The exponent of the partial remainder will be less than the exponent of the original dividend by at least 32. Software can re-execute the instruction (using the partial remainder in ST(0) as the dividend) until C2 is cleared. (Note that while executing such a remainder-computation loop, a higher-priority interrupting routine that needs the FPU can force a context switch in-between the instructions in the loop.) 
  771. An important use of the FPREM1 instruction is to reduce the arguments of periodic functions. When reduction is complete, the instruction stores the three least-significant bits of the quotient in the C3, C1, and C0 flags of the FPU status word. This information is important in argument reduction for the tangent function (using a modulus of pi/4), because it locates the original angle in the correct one of eight sectors of the unit circle. '
  772.  Flags affected
  773.  C0    Set to bit 2 (Q2) of the quotient.
  774.  C1    Set to 0 if stack underflow occurred;
  775.        otherwise, set to least significant
  776.        bit of quotient (Q0).
  777.  C2    Set to 0 if reduction complete; set
  778.        to 1 if incomplete.
  779.  C3    Set to bit 1 (Q1) of the quotient.
  780.  Instruction timings
  781.  8087         287        387      486     Pentium
  782.   -            -        95-185   72-167   20-70   NP
  783. contents
  784. screen
  785.  FPTAN - Partial tangent
  786.  Description
  787. Computes the tangent of the source operand in register ST(0), stores the result in ST(0), and pushes a 1.0 onto the FPU register stack. The source operand must be given in radians and must be less than 
  788. 2^63 . The following table shows the unmasked results obtained when computing the partial tangent of various classes of numbers, assuming that underflow does not occur. s
  789.            ST(0) SOURCE                 ST(0) DESTINATION
  790.            -Infinity                    *
  791.            -F                           -F to +F
  792.            -0                           -0
  793.            +0                           +0
  794.            +F                           -F to +F
  795.            +Infinity                    *
  796.            NaN                          NaN
  797. NOTES: F Means finite-real number. H
  798.        * Indicates floating-point invalid-arithmetic-operand exception.
  799. If the source operand is outside the acceptable range, the C2 flag in the FPU status word is set, and the value in register ST(0) remains unchanged. The instruction does not raise an exception when the source operand is out of range. It is up to the program to check the C2 flag for out-of-range conditions. Source values outside the range -2^63 to +2^63 can be reduced to the range of the instruction by subtracting an appropriate integer multiple of 2pi or by using the FPREM instruction with a divisor of 2pi. 
  800. The value 1.0 is pushed onto the register stack after the tangent has been computed to maintain compatibility with the Intel 8087 and Intel287 math coprocessors. This operation also simplifies the calculation of other trigonometric functions. For instance, the cotangent (which is the reciprocal of the tangent) can be computed by executing a FDIVR instruction after the FPTAN instruction. '
  801.  Flags affected
  802.  C1               Set to 0 if stack underflow occurred;
  803.                   set to 1 if stack overflow occurred.
  804.                   Indicates rounding direction if the
  805.                   inexact-result exception is generated:
  806.                   0 = not roundup; 1 = roundup.
  807.  C2               Set to 1 if source operand is outside
  808.                   the range -2^63 to +2^63 ; otherwise,
  809.                   cleared to 0.
  810.  C0, C3           Undefined.
  811.  Instruction timings
  812.   8087         287        387      486     Pentium
  813.  30-540       30-540    191-497  200-273   17-173  NP
  814.  Note: additional cycles required if operand > pi/4 (~3.141/4 = ~.785)
  815. contents
  816. screen
  817.  FRNDINT - Round to integer
  818.  Description
  819. Rounds the source value in the ST(0) register to the nearest integral value, depending on the current rounding mode (setting of the RC field of the FPU control word), and stores the result in ST(0). 
  820. If the source value is infinity, the value is not changed. If the source value is not an integral value, the floating-point inexact-result exception is generated. '
  821.  Flags affected
  822.  C1                Set to 0 if stack underflow occurred.
  823.                    Indicates rounding direction if the
  824.                    inexact-result exception is generated:
  825.                    0 = not roundup; 1 = roundup.
  826.  C0, C2, C3        Undefined.
  827.  Instruction timings
  828.  8087         287        387      486     Pentium
  829.  16-50        16-50      66-80    21-30    9-20    NP
  830. contents
  831. screen
  832.  FRSTOR - Restore FPU state
  833.  Description
  834. Loads the FPU state (operating environment and register stack) from the memory area specified with the source operand. This state data is typically written to the specified memory location by a previous FSAVE/FNSAVE instruction. 
  835. The FPU operating environment consists of the FPU control word, status word, tag word, instruction pointer, data pointer, and last opcode. u
  836. The FRSTOR instruction should be executed in the same operating mode as the corresponding FSAVE/FNSAVE instruction. 
  837. If one or more unmasked exception bits are set in the new FPU status word, a floating-point exception will be generated. To avoid raising exceptions when loading a new operating environment, clear all the exception flags in the FPU status word that is being loaded. '
  838.  Flags affected
  839. The C0, C1, C2, C3 flags are loaded. 1
  840.  Instruction timings
  841.  variations/
  842.  operand       8087         287        387      486     Pentium
  843.  frstor  mem  (197-207)+EA 197-207     308    131/120   75-95/70 NP
  844.  frstorw mem    -            -         308    131/120   75-95/70 NP
  845.  frstord mem    -            -         308    131/120   75-95/70 NP
  846.  Note: cycles for real mode/protected mode
  847. contents
  848. screen
  849.  FSAVE/FNSAVE - Store FPU state
  850.  Description
  851. Stores the current FPU state (operating environment and register stack) at the specified destination in memory, and then re-initializes the FPU. The FSAVE instruction checks for and handles pending unmasked floating-point exceptions before storing the FPU state; the FNSAVE instruction does not. 
  852. The FPU operating environment consists of the FPU control word, status word, tag word, instruction pointer, data pointer, and last opcode. The contents of the FPU register stack are stored in the 80 bytes immediately follow the operating environment image. 
  853. The saved image reflects the state of the FPU after all floating-point instructions preceding the FSAVE/FNSAVE instruction in the instruction stream have been executed. 
  854. After the FPU state has been saved, the FPU is reset to the same default values it is set to with the FINIT/FNINIT instructions. 
  855. The FSAVE/FNSAVE instructions are typically used when the operating system needs to perform a context switch, an exception handler needs to use the FPU, or an application program needs to pass a "clean" FPU to a procedure. %
  856. For Intel math coprocessors and FPUs prior to the Intel Pentium processor, an FWAIT instruction should be executed before attempting to read from the memory image stored with a prior FSAVE/FNSAVE instruction. This FWAIT instruction helps insure that the storage operation has been completed. 1
  857. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNSAVE instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNSAVE instruction cannot be interrupted in this way on a Pentium Pro processor. '
  858.  Flags affected
  859. The C0, C1, C2, and C3 flags are saved and then cleared. 1
  860.  Instruction timings
  861.  variations    8087         287        387      486     Pentium
  862.  fsave      (197-207)+EA  197-207    375-376  154/143  127-151/124 NP
  863.  fsavew         -            -       375-376  154/143  127-151/124 NP
  864.  fsaved         -            -       375-376  154/143  127-151/124 NP
  865.  fnsave     (197-207)+EA  197-207    375-376  154/143  127-151/124 NP
  866.  fnsavew        -            -       375-376  154/143  127-151/124 NP
  867.  fnsaved        -            -       375-376  154/143  127-151/124 NP
  868.  Note: Cycles for real mode/protected mode
  869.        The wait version may take additional cycles
  870. contents
  871. screen
  872.  FSCALE - Scale
  873.  Description
  874. Multiplies the destination operand by 2 to the power of the source operand and stores the result in the destination operand. The destination operand is a real value that is located in register ST(0). The source operand is the nearest integer value that is smaller than the value in the ST(1) register (that is, the value in register ST(1) is truncated toward 0 to its nearest integer value to form the source operand). This instruction provides rapid multiplication or division by integral powers of 2 because it is implemented by simply adding an integer value (the source operand) to the exponent of the value in register ST(0). y
  875. In most cases, only the exponent is changed and the mantissa (significand) remains unchanged. However, when the value being scaled in ST(0) is a denormal value, the mantissa is also changed and the result may turn out to be a normalized number. Similarly, if overflow or underflow results from a scale operation, the resulting mantissa will differ from the source's mantissa. ~
  876. The FSCALE instruction can also be used to reverse the action of the FXTRACT instruction, as shown in the following example: 
  877.  FXTRACT
  878.  FSCALE
  879.  FSTP st1
  880. In this example, the FXTRACT instruction extracts the significand and exponent from the value in ST(0) and stores them in ST(0) and ST(1) respectively. The FSCALE then scales the significand in ST(0) by the exponent in ST(1), recreating the original value before the FXTRACT operation was performed. The FSTP ST(1) instruction overwrites the exponent (extracted by the FXTRACT instruction) with the recreated value, which returns the stack to its original state with only one register [ST(0)] occupied. '
  881.  Flags affected
  882. C1                Set to 0 if stack underflow occurred. 
  883.                   Indicates rounding direction if the
  884.                   inexact-result exception is generated:
  885.                   0 = not roundup; 1 = roundup.
  886. C0, C2, C3        Undefined. 1
  887.  Instruction timings
  888.   8087         287        387      486     Pentium
  889.  32-38        32-38      67-86    30-32    20-31   NP
  890. contents
  891. screen
  892.  FSETPM - Set protected mode (287 only)
  893.  Description
  894. This opcode is only supported by the 287 FPU, all subsequent processors perform no operation (FNOP). '
  895.  Flags affected
  896. Not available. 1
  897.  Instruction timings
  898.  8087         287        387      486     Pentium
  899.   -           2-8        12        3       1      NP
  900. contents
  901. screen
  902.  FSIN - Sine (387+)
  903.  Description
  904. Calculates the sine of the source operand in register ST(0) and stores the result in ST(0). The source operand must be given in radians and must be within the range -2^63 to +2^63 . The following table shows the results obtained when taking the sine of various classes of numbers, assuming that underflow does not occur. 5
  905.           SOURCE (ST(0))        DESTINATION (ST(0))
  906.           -Infinity             *
  907.           -F                    -1 to +1
  908.           -0                    -0
  909.           +0                    +0
  910.           +F                    -1 to +1
  911.           +Infinity             *
  912.           NaN                   NaN
  913. NOTES: F Means finite-real number. Q
  914.        * Indicates floating-point invalid-arithmetic-operand
  915.          exception.
  916. If the source operand is outside the acceptable range, the C2 flag in the FPU status word is set, and the value in register ST(0) remains unchanged. The instruction does not raise an exception when the source operand is out of range. It is up to the program to check the C2 flag for out-of-range conditions. Source values outside the range -2^63 to +2^63 can be reduced to the range of the instruction by subtracting an appropriate integer multiple of 2pi or by using the FPREM instruction with a divisor of 2pi. '
  917.  Flags affected
  918. C1                Set to 0 if stack underflow occurred. 
  919.                   Indicates rounding direction if the
  920.                   inexact-result exception is generated:
  921.                   0 = not roundup; 1 = roundup.
  922. C2                Set to 1 if source operand is outside X
  923.                   the range -2^63 to +2^63 ; otherwise,
  924.                   cleared to 0.
  925. C0, C3            Undefined. 1
  926.  Instruction timings
  927.  8087         287        387      486     Pentium
  928.   -            -       122-771  257-354   16-126  NP
  929.  Note : Additional cycles required if operand > pi/4 (~3.141/4 = ~.785)
  930. contents
  931. screen
  932.  FSINCOS - Sine and cosine (387+)
  933.  Description
  934. Computes both the sine and the cosine of the source operand in register ST(0), stores the sine in ST(0), and pushes the cosine onto the top of the FPU register stack. (This instruction is faster than executing the FSIN and FCOS instructions in succession.) 
  935. The source operand must be given in radians and must be within the range -2^63 to +2^63 . The following table shows the results obtained when taking the sine and cosine of various classes of numbers, assuming that underflow does not occur. c
  936.      SOURCE                     DESTINATION
  937.       ST(0)         ST(1) Cosine           ST(0) Sine
  938.      -Infinity      *                      *
  939.      -F             -1 to +1               -1 to +1
  940.      -0             +1                     -0
  941.      +0             +1                     +0
  942.      +F             -1 to +1               -1 to +1
  943.      +Infinity      *                      *
  944.      NaN            NaN                    NaN
  945.  NOTES: F Means finite-real number.
  946.         * Indicates floating-point invalid-arithmetic-operand
  947.           exception.
  948. If the source operand is outside the acceptable range, the C2 flag in the FPU status word is set, and the value in register ST(0) remains unchanged. The instruction does not raise an exception when the source operand is out of range. It is up to the program to check the C2 flag for out-of-range conditions. Source values outside the range -2^63 to +2^63 can be reduced to the range of the instruction by subtracting an appropriate integer multiple of 2pi or by using the FPREM instruction with a divisor of 2pi. '
  949.  Flags affected
  950. C1                Set to 0 if stack underflow occurred; 5
  951.                   set to 1 of stack overflow occurs.
  952.                   Indicates rounding direction if the
  953.                   inexact-result exception is generated:
  954.                   0 = not roundup; 1 = roundup.
  955. C2                Set to 1 if source operand is outside X
  956.                   the range -2^63 to +2^63 ; otherwise,
  957.                   cleared to 0.
  958. C0, C3            Undefined. 1
  959.  Instruction timings
  960.  8087         287        387      486     Pentium
  961.   -            -       194-809  292-365   17-137  NP
  962. Note: Additional cycles required if operand > pi/4 (~3.141/4 = ~.785) 
  963. contents
  964. screen
  965.  FSQRT - Square root
  966.  Description
  967. Calculates the square root of the source value in the ST(0) register and stores the result in ST(0). 
  968. The following table shows the results obtained when taking the square root of various classes of numbers, assuming that neither overflow nor underflow occurs. 0
  969.        SOURCE (ST(0))           DESTINATION (ST(0))
  970.        -Infinity                *
  971.        -F                       *
  972.        -0                       -0
  973.        +0                       +0
  974.        +F                       +F
  975.        +Infinity                +Infinity
  976.        NaN                      NaN
  977.  NOTES: F Means finite-real number.
  978.         * Indicates floating-point invalid-arithmetic-operand
  979.           exception.
  980.  Flags affected
  981.  C1                Set to 0 if stack underflow occurred.
  982.                    Indicates rounding direction if
  983.                    inexact-result exception is generated:
  984.                    0 = not roundup; 1 = roundup.
  985.  C0, C2, C3        Undefined.
  986.  Instruction timings
  987.    8087         287        387      486     Pentium
  988.  180-186      180-186    122-129   83-87    70      NP
  989. contents
  990. screen
  991.  FST/FSTP - Store real
  992.  Description
  993. The FST instruction copies the value in the ST(0) register to the destination operand, which can be a memory location or another register in the FPU register stack. When storing the value in memory, the value is converted to single- or double-real format. 1
  994. The FSTP instruction performs the same operation as the FST instruction and then pops the register stack. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The FSTP instruction can also store values in memory in extended-real format. 
  995. If the destination operand is a memory location, the operand specifies the address where the first byte of the destination value is to be stored. If the destination operand is a register, the operand specifies a register in the register stack relative to the top of the stack. 
  996. If the destination size is single- or double-real, the significand of the value being stored is rounded to the width of the destination (according to rounding mode specified by the RC field of the FPU control word), and the exponent is converted to the width and bias of the destination format. If the value being stored is too large for the destination format, a numeric overflow exception is generated and, if the exception is unmasked, no value is stored in the destination operand. If the value being stored is a denormal value, the denormal exception is not generated. This condition is simply signaled as a numeric underflow exception condition. 
  997. If the value being stored is 
  998. infinity, or a NaN, the least-significant bits of the significand and the exponent are truncated to fit the destination format. This operation preserves the value's identity as a 0, infinity, or NaN. g
  999. If the destination operand is a non-empty register, the invalid-operation exception is not generated. '
  1000.  Flags affected
  1001. C1                Set to 0 if stack underflow occurred. 
  1002.                   Indicates rounding direction of if the
  1003.                   floating-point inexact exception is
  1004.                   generated: 0 = not roundup; 1 = roundup.
  1005. C0, C2, C3        Undefined. 1
  1006.  Instruction timings
  1007.  variations/
  1008.  operand       8087         287        387      486     Pentium
  1009.  fst  reg     15-22        15-22       11        3       1      NP
  1010.  fst  mem32  (84-90)+EA    84-90       44        7       2      NP
  1011.  fst  mem64  (96-104)+EA   96-104      45        8       2      NP
  1012.  fstp reg     17-24        17-24       12        3       1      NP
  1013.  fstp mem32  (86-92)+EA    86-92       44        7       2      NP
  1014.  fstp mem64  (98-106)+EA   98-106      45        8       2      NP
  1015.  fstp mem80  (52-58)+EA    52-58       53        6       3      NP
  1016. contents
  1017. screen
  1018.  FSTCW/FNSTCW - Store control word
  1019.  Description
  1020. Stores the current value of the FPU control word at the specified destination in memory. The FSTCW instruction checks for and handles pending unmasked floating-point exceptions before storing the control word; the FNSTCW instruction does not. 1
  1021. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNSTCW instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNSTCW instruction cannot be interrupted in this way on a Pentium Pro processor. '
  1022.  Flags affected
  1023. The C0, C1, C2, and C3 flags are undefined. 1
  1024.  Instruction timings
  1025.  variations/
  1026.  operand       8087         287        387      486     Pentium
  1027.  fstcw  mem   12-18        12-18       15        3       2      NP
  1028.  fnstcw mem   12-18        12-18       15        3       2      NP
  1029.  Note: The wait version (FSTCW) may take additional cycles
  1030. contents
  1031. screen
  1032.  FSTENV/FNSTENV - Store FPU environment
  1033.  Description
  1034. Saves the current FPU operating environment at the memory location specified with the destination operand, and then masks all floating-point exceptions. The FPU operating environment consists of the FPU control word, status word, tag word, instruction pointer, data pointer, and last opcode. O
  1035. The FSTENV instruction checks for and handles any pending unmasked floating-point exceptions before storing the FPU environment; the FNSTENV instruction does not. The saved image reflects the state of the FPU after all floating-point instructions preceding the FSTENV/FNSTENV instruction in the instruction stream have been executed. 0
  1036. These instructions are often used by exception handlers because they provide access to the FPU instruction and data pointers. The environment is typically saved in the stack. Masking all exceptions after saving the environment prevents floating-point exceptions from interrupting the exception handler. 3
  1037. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNSTENV instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNSTENV instruction cannot be interrupted in this way on a Pentium Pro processor. '
  1038.  Flags affected
  1039. The C0, C1, C2, and C3 are undefined. 1
  1040.  Instruction timings
  1041.  variations/
  1042.  operand       8087         287        387      486     Pentium
  1043.  fstenv   mem  (40-50)+EA    40-50     103-104   67/56    48-50   NP
  1044.  fstenvw  mem                          103-104   67/56    48-50   NP
  1045.  fstenvd  mem                          103-104   67/56    48-50   NP
  1046.  fnstenv  mem  (40-50)+EA    40-50     103-104   67/56    48-50   NP
  1047.  fnstenvw mem                          103-104   67/56    48-50   NP
  1048.  fnstenvd mem                          103-104   67/56    48-50   NP
  1049.  Note: Cycles for real mode/protected mode
  1050.        The wait version may take additional cycles
  1051. contents
  1052. screen
  1053.  FSTSW/FNSTSW - Store status word
  1054.  Description
  1055. Stores the current value of the FPU status word in the destination location. The destination operand can be either a two-byte memory location or the AX register. The FSTSW instruction checks for and handles pending unmasked floating-point exceptions before storing the status word; the FNSTSW instruction does not. 
  1056. The FNSTSW AX form of the instruction is used primarily in conditional branching (for instance, after an FPU comparison instruction or an FPREM, FPREM1, or FXAM instruction), where the direction of the branch depends on the state of the FPU condition code flags. This instruction can also be used to invoke exception handlers (by examining the exception flags) in environments that do not use interrupts. When the FNSTSW AX instruction is executed, the AX register is updated before the processor executes any further instructions. The status stored in the AX register is thus guaranteed to be from the completion of the prior FPU instruction. 1
  1057. When operating a Pentium or 486 processor in MS-DOS compatibility mode, it is possible (under unusual circumstances) for an FNSTSW instruction to be interrupted prior to being executed to handle a pending FPU exception. An FNSTSW instruction cannot be interrupted in this way on a Pentium Pro processor. '
  1058.  Flags affected
  1059. The C0, C1, C2, and C3 are undefined. 1
  1060.  Instruction timings
  1061.  variations/
  1062.  operand       8087         287        387      486     Pentium
  1063.  fstsw  mem   12-18        12-18       15        3       2      NP
  1064.  fstsw  ax      -          10-16       13        3       2      NP
  1065.  fnstsw mem   12-18        12-18       15        3       2      NP
  1066.  fnstsw ax      -          10-16       13        3       2      NP
  1067.  Note: The wait version may take additional cycles
  1068. contents
  1069. screen
  1070.  FSUB/FSUBP/FISUB - Subtract
  1071.  Description
  1072. Subtracts the source operand from the destination operand and stores the difference in the destination location. The destination operand is always an FPU data register; the source operand can be a register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. 
  1073. The no-operand version of the instruction subtracts the contents of the ST(0) register from the ST(1) register and stores the result in ST(1). The one-operand version subtracts the contents of a memory location (either a real or an integer value) from the contents of the ST(0) register and stores the result in ST(0). The two-operand version, subtracts the contents of the ST(0) register from the ST(i) register or vice versa. 
  1074. The FSUBP instructions perform the additional operation of popping the FPU register stack following the subtraction. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The no-operand version of the floating-point subtract instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FSUB rather than FSUBP. u
  1075. The FISUB instructions convert an integer source operand to extended-real format before performing the subtraction. *
  1076. When the difference between two operands of like sign is 0, the result is +0, except for the round toward -infinity mode, in which case the result is -0. This instruction also guarantees that +0 - (-0) = +0, and that -0 - (+0) = -0. When the source operand is an integer 0, it is treated as a +0. 
  1077. When one operand is infinity, the result is infinity of the expected sign. If both operands are infinity of the same sign, an invalid-operation exception is generated. '
  1078.  Flags affected
  1079.  C1                Set to 0 if stack underflow occurred.
  1080.                    Indicates rounding direction if the
  1081.                    inexact-result exception fault is
  1082.                    generated: 0 = not roundup; 1 = roundup.
  1083.  C0, C2, C3        Undefined.
  1084.  Instruction timings
  1085.  variations/
  1086.  operand       8087          287        387      486     Pentium
  1087.  fsub  reg     70-100       70-100     26-37     8-20    3/1     FX
  1088.  fsub  mem32  (90-120)+EA   90-120     24-32     8-20    3/1     FX
  1089.  fsub  mem64  (95-125)+EA   95-125     28-36     8-20    3/1     FX
  1090.  fsubp reg     75-105       75-105     26-34     8-20    3/1     FX
  1091.  fisub mem16 (102-137)+EA  102-137     71-85    20-35    7/4     NP
  1092. contents
  1093. screen
  1094.  FSUBR/FSUBRP/FISUBR - Reverse subtract
  1095.  Description
  1096. Subtracts the destination operand from the source operand and stores the difference in the destination location. The destination operand is always an FPU register; the source operand can be a register or a memory location. Source operands in memory can be in single-real, double-real, word-integer, or short-integer formats. 
  1097. These instructions perform the reverse operations of the FSUB, FSUBP, and FISUB instructions. They are provided to support more efficient coding. 
  1098. The no-operand version of the instruction subtracts the contents of the ST(1) register from the ST(0) register and stores the result in ST(1). The one-operand version subtracts the contents of the ST(0) register from the contents of a memory location (either a real or an integer value) and stores the result in ST(0). The two-operand version, subtracts the contents of the ST(i) register from the ST(0) register or vice versa. 
  1099. The FSUBRP instructions perform the additional operation of popping the FPU register stack following the subtraction. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. The no-operand version of the floating-point reverse subtract instructions always results in the register stack being popped. In some assemblers, the mnemonic for this instruction is FSUBR rather than FSUBRP. v
  1100. The FISUBR instructions convert an integer source operand to extended-real format before performing the subtraction. 
  1101. When the difference between two operands of like sign is 0, the result is +0, except for the round toward -infinity mode, in which case the result is -0. This instruction also guarantees that +0 - (-0) = +0, and that -0 - (+0) = -0. When the source operand is an integer 0, it is treated as a +0. When one operand is infinity, the result is infinity of the expected sign. If both operands are infinity of the same sign, an invalid-operation exception is generated. '
  1102.  Flags affected
  1103.  C1                Set to 0 if stack underflow occurred.
  1104.                    Indicates rounding direction if the
  1105.                    inexact-result exception fault is
  1106.                    generated: 0 = not roundup; 1 = roundup.
  1107.  C0, C2, C3        Undefined.
  1108.  Instruction timings
  1109.  variations/
  1110.  operand       8087          287        387      486     Pentium
  1111.  fsubr  reg    70-100       70-100     26-37     8-20    3/1     FX
  1112.  fsubr  mem32 (90-120)+EA   90-120     24-32     8-20    3/1     FX
  1113.  fsubr  mem64 (95-125)+EA   95-125     28-36     8-20    3/1     FX
  1114.  fsubrp reg    75-105       75-105     26-34     8-20    3/1     FX
  1115.  fisubr mem32 (108-143)+EA  108-143     57-82    19-32    7/4     NP
  1116. contents
  1117. screen
  1118.  FTST - Test
  1119.  Description
  1120. Compares the value in the ST(0) register with 0.0 and sets the condition code flags C0, C2, and C3 in the FPU status word according to the results (see table below). 1
  1121. This instruction performs an "unordered comparison." An unordered comparison also checks the class of the numbers being compared (see FXAM). If the value in register ST(0) is a NaN or is in an undefined format, the condition flags are set to "unordered" and the invalid operation exception is generated. 3
  1122. The sign of zero is ignored, so that -0.0 = +0.0. 
  1123.     Condition           C3       C2      C0
  1124.     ST(0) > 0.0         0        0       0
  1125.     ST(0) < 0.0         0        0       1
  1126.     ST(0) = 0.0         1        0       0
  1127.     Unordered           1        1       1
  1128.  Flags affected
  1129.  C1                Set to 0 if stack underflow occurred;
  1130.                    otherwise, cleared to 0.
  1131.  C0, C2, C3        See above table.
  1132.  Instruction timings
  1133.   8087         287        387      486     Pentium
  1134.  38-48        38-48       28        4      4/1     FX
  1135. contents
  1136. screen
  1137.  FUCOM/FUCOMP/FUCOMPP - Unordered compare real (387+)
  1138.  Description
  1139. Performs an unordered comparison of the contents of register ST(0) and ST(i) and sets condition code flags C0, C2, and C3 in the FPU status word according to the results (see the table below). If no operand is specified, the contents of registers ST(0) and ST(1) are compared. The sign of zero is ignored, so that -0.0 = +0.0. 
  1140.      Comparison Results         C3      C2      C0
  1141.      ST0 > ST(i)                0       0       0
  1142.      ST0 < ST(i)                0       0       1
  1143.      ST0 = ST(i)                1       0       0
  1144.      Unordered                  1       1       1
  1145.  NOTE: * Flags not set if unmasked invalid-arithmetic-operand
  1146.          exception is generated.
  1147. An unordered comparison checks the class of the numbers being compared (see FXAM). The FUCOM instructions perform the same operations as the FCOM instructions. The only difference is that the FUCOM instructions raise the invalid-arithmetic- operand exception only when either or both operands are an SNaN or are in an unsupported format; QNaNs cause the condition code flags to be set to unordered, but do not cause an exception to be generated. The FCOM instructions raise an invalid-operation exception when either or both of the operands are a NaN value of any kind or are in an unsupported format. 
  1148. As with the FCOM instructions, if the operation results in an invalid-arithmetic-operand exception being raised, the condition code flags are set only if the exception is masked. )
  1149. The FUCOMP instruction pops the register stack following the comparison operation and the FUCOMPP instruction pops the register stack twice following the comparison operation. To pop the register stack, the processor marks the ST(0) register as empty and increments the stack pointer (TOP) by 1. '
  1150.  Flags affected
  1151.  C1                Set to 0 if stack underflow occurred.
  1152.  C0, C2, C3        See table above.
  1153.  Instruction timings
  1154.  variations    8087         287        387      486     Pentium
  1155.  fucom          -            -         24        4      4/1     FX
  1156.  fucomp         -            -         26        4      4/1     FX
  1157.  fucompp        -            -         26        5      4/1     FX
  1158. contents
  1159. screen
  1160.  FWAIT - Wait
  1161.  Description
  1162. Causes the processor to check for and handle pending, unmasked, floating-point exceptions before proceeding. (FWAIT is an alternate mnemonic for the WAIT instruction). )
  1163. This instruction is useful for synchronizing exceptions in critical sections of code. Coding a WAIT instruction after a floating-point instruction insures that any unmasked floating-point exceptions the instruction may raise are handled before the processor can modify the instruction's results. '
  1164.  Flags affected
  1165. The C0, C1, C2, and C3 flags are undefined. 1
  1166.  Instruction timings
  1167.  8087         287        387      486     Pentium
  1168.   4            3          6       1-3     1-3     NP
  1169. contents
  1170. screen
  1171.  FXAM - Examine
  1172.  Description
  1173. Examines the contents of the ST(0) register and sets the condition code flags C0, C2, and C3 in the FPU status word to indicate the class of value or number in the register (see the table below). Z
  1174.  Class                  C3       C2      C0
  1175.  Unsupported            0        0       0
  1176.  NaN                    0        0       1
  1177.  Normal finite number   0        1       0
  1178.  Infinity               0        1       1
  1179.  Zero                   1        0       0
  1180.  Empty                  1        0       1
  1181.  Denormal number        1        1       0
  1182. The C1 flag is set to the sign of the value in ST(0), regardless of whether the register is empty or full. '
  1183.  Flags affected
  1184.  C1               Sign of value in ST(0).
  1185.  C0, C2, C3       See table above.
  1186.  Instruction timings
  1187.   8087         287        387      486     Pentium
  1188.  12-23        12-23      30-38      8      21      NP
  1189. contents
  1190. screen
  1191.  FXCH - Exchange register contents
  1192.  Description
  1193. Exchanges the contents of registers ST(0) and ST(i). If no source operand is specified, the contents of ST(0) and ST(1) are exchanged. e
  1194. This instruction provides a simple means of moving values in the FPU register stack to the top of the stack [ST(0)], so that they can be operated on by those floating-point instructions that can only operate on values in ST(0). For example, the following instruction sequence takes the square root of the third register from the top of the register stack: 
  1195.  FXCH st3
  1196.  FSQRT
  1197.  FXCH st3
  1198.  Flags affected
  1199.  C1               Set to 0 if stack underflow occurred;
  1200.                   otherwise, cleared to 0.
  1201.  C0, C2, C3       Undefined.
  1202.  Instruction timings
  1203.   8087         287        387      486     Pentium
  1204.  10-15        10-15       18        4      0-1     *
  1205.  Note: * FCXH is pairable in the V pipe with all FX pairable instructions
  1206. contents
  1207. screen
  1208.  FXTRACT - Extract exponent and significand
  1209.  Description
  1210. Separates the source value in the ST(0) register into its exponent and significand, stores the exponent in ST(0), and pushes the significand onto the register stack. Following this operation, the new top-of-stack register ST(0) contains the value of the original significand expressed as a real number. The sign and significand of this value are the same as those found in the source operand, and the exponent is 3FFFH (biased value for a true exponent of zero). The ST(1) register contains the value of the original operand's true (unbiased) exponent expressed as a real number. (The operation performed by this instruction is a superset of the IEEE-recommended logb(x) function.) 
  1211. This instruction and the F2XM1 instruction are useful for performing power and range scaling operations. The FXTRACT instruction is also useful for converting numbers in extended-real format to decimal representations (e.g. for printing or displaying). 
  1212. If the floating-point zero-divide exception is masked and the source operand is zero, an exponent value of -infinity is stored in register ST(1) and 0 with the sign of the source operand is stored in register ST(0). '
  1213.  Flags affected
  1214.  C1                Set to 0 if stack underflow occurred;
  1215.                    set to 1 if stack overflow occurred.
  1216.  C0, C2, C3        Undefined.
  1217.  Instruction timings
  1218.   8087         287        387      486     Pentium
  1219.  27-55        27-55      70-76    16-20    13      NP
  1220. contents
  1221. screen
  1222.  FYL2X - Compute y * log x (base 2)
  1223.  Description
  1224. Calculates (ST(1) * log (base 2) (ST(0))), stores the result in resister ST(1), and pops the FPU register stack. The source operand in ST(0) must be a non-zero positive number. 
  1225. If the divide-by-zero exception is masked and register ST(0) contains 
  1226. 0, the instruction returns infinity with a sign that is the opposite of the sign of the source operand in register ST(1). 
  1227. The FYL2X instruction is designed with a built-in multiplication to optimize the calculation of logarithms with an arbitrary positive base (b): .
  1228. log x = (log (base 2) b) -1 * log (base 2) x '
  1229.  Flags affected
  1230.  C1               Set to 0 if stack underflow occurred.
  1231.                   Indicates rounding direction if the
  1232.                   inexact-result exception is generated:
  1233.                   0 = not roundup; 1 = roundup.
  1234.  C0, C2, C3       Undefined.
  1235.  Instruction timings
  1236.     8087         287        387      486     Pentium
  1237.   900-1100     900-1100   120-538  196-329   22-111  NP
  1238. contents
  1239. screen
  1240.  FYL2XP1 - Compute y * log (base 2) (x + 1)
  1241.  Description
  1242. Calculates the log epsilon (ST(1) * log (base 2) (ST(0) + 1.0)), stores the result in register ST(1), and pops the FPU register stack. The source operand in ST(0) must be in the range: +
  1243.  - (1 - SQRT(2) / 2) to (1 - SQRT(2) / 2)
  1244. The source operand in ST(1) can range from -infinity to +infinity. If the ST(0) operand is outside of its acceptable range, the result is undefined and software should not rely on an exception being generated. Under some circumstances exceptions may be generated when ST(0) is out of range, but this behavior is implementation specific and not guaranteed. 
  1245. This instruction provides optimal accuracy for values of epsilon [the value in register ST(0)] that are close to 0. When the epsilon value (e) is small, more significant digits can be retained by using the FYL2XP1 instruction than by using (e + 1) as an argument to the FYL2X instruction. The (e + 1) expression is commonly found in compound interest and annuity calculations. The result can be simply converted into a value in another logarithm base by including a scale factor in the ST(1) source operand. '
  1246.  Flags affected
  1247.  C1                Set to 0 if stack underflow occurred.
  1248.                    Indicates rounding direction if the
  1249.                    inexact-result exception is generated:
  1250.                    0 = not roundup; 1 = roundup.
  1251.  C0, C2, C3        Undefined.
  1252.  Instruction timings
  1253.    8087         287        387      486     Pentium
  1254.  700-1000     700-1000   257-547  171-326   22-103  NP
  1255. contents
  1256. screen
  1257.  N!N"N#N$N%N&N'N(N)N*N+N,N-N.N/N0N1N2N3N4N5N6N7N8N9N:N;N<N=N>N?N@NANBNCNDNENFNGNHNINJNKNLNMNNNONPNQNRNSNTNUNVNWNXN
  1258.