fctiwz

Floating Convert to Integer Word with Round to Zero

fctiwz FRT, FRB

Converts Double to 32-bit Int (Truncate).

Details

Floating Convert to Integer Word with Round to Zero converts the double-precision floating-point value in FRB to a signed 32-bit integer, truncating toward zero, and places the result in FRT as a floating-point representation. FPSCR is updated with FPRF, FR, and FI flags; exception flags (XX, ZX) are set if applicable.

Pseudocode Operation

FRT ← (int32_t)truncate(FRB)
Update FPSCR[FPRF, FR, FI, XX, ZX]

Programming Note

The fctiwz instruction is commonly used for converting floating-point numbers to integers with truncation. Be cautious of NaN inputs, which will result in zero and set VXCVI; SNaNs also set VXSNAN. Ensure the input is within the 32-bit signed integer range to avoid saturation. This instruction operates at user privilege level.

Example

fctiwz f1, f3

Encoding

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

Operands

  • FRT
    Target
  • FRB
    Source