FISTTP

Store Integer with Truncation

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
DD /1 FISTTP m64int None Valid Valid Store ST(0) in m64int with truncation.
DB /1 FISTTP m32int None Valid Valid Store ST(0) in m32int with truncation.
DF /1 FISTTP m16int None Valid Valid Store ST(0) in m16int with truncation.

Description

FISTTP converts the value in ST into a signed integer using truncation (chop) as rounding mode, transfers the result to the destination, and pop ST. FISTTP accepts word, short integer, and long integer destinations.

The following table shows the results obtained when storing various classes of numbers in integer format.

FISTTP Results
ST(0) DEST
-∞ or Value Too Large for DEST Format *
F ≤ - 1 - I
- 1 < F < + 1 0
F ≥ + 1 + I
+∞ or Value Too Large for DEST Format *
NaN *

This instruction's operation is the same in non-64-bit modes and 64-bit mode.

Pseudo Code

DEST = ST;
pop ST;

Flags Affected

C1 is cleared; C0, C2, C3 undefined. Numeric Exceptions Invalid, Stack Invalid (stack underflow), Precision.

Exceptions

Numeric Exceptions

Invalid, Stack Invalid (stack underflow), Precision.

64-Bit Mode Exceptions

Exception Description
#AC(0) If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3. If the LOCK prefix is used.
#PF(fault-code) If a page fault occurs.
#MF If there is a pending x87 FPU exception.
#NM CR0.EM[bit 2] or CR0.TS[bit 3] = 1.
#GP(0) If the memory address is in a non-canonical form.
#SS(0) If a memory address referencing the SS segment is in a non- canonical form.

Compatibility Mode Exceptions

Same exceptions as in protected mode.

Virtual-8086 Mode Exceptions

Exception Description
#AC(0) For unaligned memory reference if the current privilege is 3.
#PF(fault-code) For a page fault.
#UD If CPUID.01H:ECX.SSE3[bit 0] = 0. If the LOCK prefix is used.
#NM If CR0.EM[bit 2] = 1. If CR0.TS[bit 3] = 1.
#GP(0) If any part of the operand would lie outside of the effective address space from 0 to 0FFFFH.

Real-Address Mode Exceptions

Exception Description
#UD If CPUID.01H:ECX.SSE3[bit 0] = 0. If the LOCK prefix is used.
#NM If CR0.EM[bit 2] = 1. If CR0.TS[bit 3] = 1.
#GP(0) If any part of the operand would lie outside of the effective address space from 0 to 0FFFFH.

Protected Mode Exceptions

Exception Description
#UD If CPUID.01H:ECX.SSE3[bit 0] = 0. If the LOCK prefix is used.
#NM If CR0.EM[bit 2] = 1. If CR0.TS[bit 3] = 1.
#AC(0) If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3.
#PF(fault-code) For a page fault.
#SS(0) For an illegal address in the SS segment.
#GP(0) If the destination is in a nonwritable segment. For an illegal memory operand effective address in the CS, DS, ES, FS or GS segments.