Rounds a 64-bit, double precision floating-point operand to single precision and places the result in a floating-point register.
frsp | FRT,FRB |
frsp. | FRT,FRB |
The frsp instruction rounds the 64-bit, double-precision floating-point operand in floating-point register (FPR) FRB to single precision, using the rounding mode specified by the Floating Rounding Control field of the Floating-Point Status and Control Register, and places the result in the target FPR FRT.
The Floating-Point Result Flags Field of the Floating-Point Status and Control Register is set to the class and sign of the result, except for Invalid Operation (SNaN), when Floating-Point Status and Control Register Floating-Point Invalid Operation Exception Enable bit is 1.
The frsp instruction has two syntax forms. Each syntax form has a different effect on Condition Register Field 1.
Syntax Form | Floating-Point Status and Control Register | Record Bit (Rc) | Condition Register Field 1 |
frsp | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN | 0 | None |
frsp. | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN | 1 | FX,FEX,VX,OX |
The two syntax forms of the frsp instruction always affect the Floating-Point Status and Control Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Floating-Point Exception (FX), Floating-Point Enabled Exception (FEX), Floating-Point Invalid Operation Exception (VX), and Floating-Point Overflow Exception (OX) bits in Condition Register Field 1.
Notes:
- The frsp instruction uses the target register of a previous floating-point arithmetic operation as its source register (FRB). The frsp instruction is said to be dependent on the preceding floating-point arithmetic operation when it uses this register for source.
- Less than two nondependent floating-point arithmetic operations occur between the frsp instruction and the operation on which it is dependent.
- The magnitude of the double-precision result of the arithmetic operation is less than 2**128 before rounding.
- The magnitude of the double-precision result after rounding is exactly 2**128.
If the error occurs, the magnitude of the result placed in the target register FRT is 2**128:
X'47F0000000000000' or X'C7F0000000000000'
This is not a valid single-precision value. The settings of the Floating-Point Status and Control Register and the Condition Register will be the same as if the result does not overflow.
If the above error will cause significant problems in an application, either of the following two methods can be used to avoid the error.
Either solution will degrade performance by an amount dependent on the particular application.
FRT | Specifies target floating-point register for operation. |
FRB | Specifies source floating-point register for operation. |
# Assume FPR 4 contains 0xC053 4000 0000 0000. # Assume FPSCR = 0. frsp 6,4 # FPR 6 now contains 0xC053 4000 0000 0000. # FPSCR now contains 0x0000 8000.
# Assume CR contains 0x0000 0000. # Assume FPR 4 contains 0xFFFF FFFF FFFF FFFF. # Assume FPSCR = 0. frsp. 6,4 # FPR 6 now contains 0xFFFF FFFF E000 0000. # FPSCR now contains 0x0001 1000. # CR now contains 0x0000 0000.
Interpreting the Contents of a Floating-Point Register .
Floating-Point Arithmetic Instructions .