fctiwz

Floating Convert to Integer Word with Round to Zero

fctiwz FRT, FRB

Converts Double to 32-bit Int (Truncate).

Encoding

Binary Layout
63
0:5
FRT
6:10
0
11:15
FRB
16:20
15
21:30
/
31
 
Format X-form
Opcode 0xFC00001E
Extension Floating-Point

Operands

  • FRT
    Target
  • FRB
    Source

Example

fctiwz f1, f3

Registers Altered

FPSCR

Related

More in Floating-Point

Reference

Description

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.

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.