fctiwu

Floating Convert with round Double-Precision To Unsigned Word format

fctiwu FRT,FRB

Converts a double-precision floating-point value to an unsigned integer using rounding.

Details

The instruction converts the double-precision floating-point value in FRB to an unsigned integer using the rounding mode specified by RN. If the result is out of range, it sets VXCVI and returns 0xFFFF_FFFF or 0x0000_0000. The result is placed into FRT32:63 and FRT0:31 is undefined.

Pseudocode Operation

if src is NaN then
    result <- 0x0000_0000
    VXCVI <- 1
    if src is SNaN then VXSNAN <- 1
else
    rounded_value <- round(src, RN)
    if rounded_value > 2^32 - 1 then
        result <- 0xFFFF_FFFF
        VXCVI <- 1
    else if rounded_value < 0 then
        result <- 0x0000_0000
        VXCVI <- 1
    else
        result <- convert_to_unsigned_int(rounded_value)
        XX <- is_inexact(result)
FRT32:63 <- result
FRT0:31 is undefined

Programming Note

When Rc=1, CR1 is set from the FPSCR[FX, FEX, VX, OX] bits immediately after the operation completes.

Example

fctiwu f1, f3

Encoding

Binary Layout
0
0
FRT
6
FRB
11
Rc
31
 
Format X-form
Opcode 0xFC00011C
Extension Floating-Point
Registers Altered FPSCR, (FR, FI, FX, XX, VXSNAN, VXCVI), CR1, (if, Rc=1), CR0

Operands

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