fctidz

Floating Convert to Integer Doubleword with Round to Zero

fctidz FRT, FRB

Converts Double to 64-bit Int (Truncate).

Details

The fctidz instruction converts a double-precision floating-point value to a signed 64-bit integer, rounding towards zero. If the source value is NaN, it returns 0x8000_0000_0000_0000 and sets VXCVI to 1. If the rounded value exceeds the range of a 64-bit signed integer, it saturates to either 0x7FFF_FFFF_FFFF_FFFF or 0x8000_0000_0000_0000.

Pseudocode Operation

if src is NaN then
    result ← 0x8000_0000_0000_0000
    VXCVI ← 1
    if src is SNaN then
        VXSNAN ← 1
else
    rounded_value ← round_towards_zero(src)
    if rounded_value > 2^63 - 1 then
        result ← 0x7FFF_FFFF_FFFF_FFFF
        VXCVI ← 1
    else if rounded_value < -2^63 then
        result ← 0x8000_0000_0000_0000
        VXCVI ← 1
    else
        result ← convert_to_signed_integer(rounded_value)
        XX ← 1 if result is inexact
if no Invalid Operation Exception occurs then
    FRT ← result

Programming Note

The fctidz instruction converts a double-precision floating-point value to a signed 64-bit integer, rounding towards zero. If the source value is NaN, it returns 0x8000_0000_0000_0000 and sets VXCVI to 1. If the rounded value exceeds the range of a 64-bit signed integer, it saturates to either 0x7FFF_FFFF_FFFF_FFFF or 0x8000_0000_0000_0000.

Example

fctidz f1, f3

Encoding

Binary Layout
63
0
FRT
6
0
11
FRB
16
815
21
/
31
 
Format X-form
Opcode 0xFC00065E
Extension Floating-Point
Registers Altered FPSCR

Operands

  • FRT
    Target
  • FRB
    Source