fctiwuz

Floating Convert with truncate Double-Precision To Unsigned Word format

fctiwuz[.] FRT,FRB

Converts a double-precision floating-point number to an unsigned integer word.

Details

The double-precision floating-point operand in FRB is converted to a 32-bit unsigned integer using truncation (round toward zero), and the result is placed in the low-order 32 bits of FRT. If the operand is a NaN or less than 0, the result is 0. If the operand is greater than the maximum unsigned 32-bit value, the result is 0xFFFFFFFF. The high-order 32 bits of FRT are undefined. The FPSCR is updated to reflect the result of the operation.

Pseudocode Operation

if FPSCR[VXSNAN] then FRT ← undefined
else
  src ← (FRB)
  if src is NaN or src < 0 then
    result ← 0x00000000
    FPSCR[VXCVI] ← 1
  else if src > 2^32 - 1 then
    result ← 0xFFFFFFFF
    FPSCR[VXCVI] ← 1
  else
    result ← truncate(src) converted to unsigned 32-bit integer
  FRT[32:63] ← result
  FRT[0:31] ← undefined

Programming Note

The fctiwuz instruction converts a double-precision floating-point number to an unsigned 32-bit integer by truncating towards zero. If the input is NaN, negative, or exceeds the maximum unsigned 32-bit value, it results in 0 or 0xFFFFFFFF respectively, and sets VXCVI in FPSCR. The high-order bits of FRT are undefined after this operation.

Example

fctiwuz[.] f1, f3

Encoding

Binary Layout
18
0
LI
6
AA
30
LK
31
 
Format X-form
Opcode 0xFC00011C
Extension Floating-Point
Registers Altered CR0, XER, FPSCR

Operands

  • FRT
    Target Floating Point Register
  • FRB
    Source Floating Point Register