xsrqpi

VSX Scalar Round Quad-Precision to Integer

xsrqpi vD, vB, R

Rounds a quad-precision floating-point value in VRB to an integer and places the result in VRT.

Details

Rounds a 128-bit quad-precision floating-point value in VSR vB to an integer value using rounding mode R, placing the result back in VSR vD as a quad-precision value. The rounding mode R is encoded in bit 31 (0=round-to-nearest-even, 1=round-toward-zero). FPSCR exception flags (XX, ZX) are updated based on the rounding operation. Requires VSX support.

Pseudocode Operation

rmode ← (R == 0) ? RoundToNearestEven : RoundTowardZero
vD ← RoundToInteger(vB, rmode) as quad-precision
FPSCR[XX,ZX] ← updated based on rounding result

Programming Note

The xsrqpi instruction is used to round a quad-precision floating-point value to an integer. Ensure that the VSX feature is enabled in the MSR register. Be cautious with NaN values, as they can trigger exceptions and set specific flags. The rounding mode is determined by the RMC field and the FPSCR.RN setting when R=0.

Example

xsrqpi vd, vb, 0

Encoding

Binary Layout
63
0
VRT
16
VRB
21
RMC
23
EX
30
R
31
 
Format Z23-form
Opcode 0xFC000005
Extension VSX
Registers Altered FPSCR, VXSNAN, FX

Operands

  • vD
    Target
  • vB
    Source
  • R
    Mode
  • VRT
    Target Vector Register
  • VRB
    Source Vector Register
  • RMC
    Rounding Mode Control