xsmsubqp

VSX Scalar Multiply-Subtract Quad-Precision

xsmsubqp VRT,VRA,VRB
xsmsubqpo VRT,VRA,VRB

Performs a multiply-subtract operation on quad-precision floating-point values.

Details

The xsmsubqp instruction multiplies the contents of VSR[VRA+32] and VSR[VRB+32], subtracts the negated value of VSR[VRT+32], and stores the result in VSR[VRT+32].

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()
reset_xflags()
src1 ← bfp_CONVERT_FROM_BFP128(VSR[VRA+32])
src2 ← bfp_CONVERT_FROM_BFP128(VSR[VRT+32])
src3 ← bfp_CONVERT_FROM_BFP128(VSR[VRB+32])
v ← bfp_MULTIPLY_ADD(src1, src3, bfp_NEGATE(src2))
rnd ← bfp_ROUND_TO_BFP128(RO, FPSCR.RN, v)
result ← bfp128_CONVERT_FROM_BFP(rnd)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
if vximz_flag=1 then SetFX(FPSCR.VXIMZ)
if vxisi_flag=1 then SetFX(FPSCR.VXISI)
if ox_flag=1 then SetFX(FPSCR.OX)
if ux_flag=1 then SetFX(FPSCR.UX)
if xx_flag=1 then SetFX(FPSCR.XX)
vx_flag ← vxsnan_flag | vximz_flag | vxisi_flag
vex_flag ← FPSCR.VE & vx_flag
if vex_flag=0 then do
  VSR[VRT+32] ← result
end
FPSCR.FPRF ← fprf_CLASS_BFP128(result)
FPSCR.FR ← (vx_flag=0) & inc_flag
FPSCR.FI ← (vx_flag=0) & xx_flag

Programming Note

The xsmsubqp instruction is used for performing a multiply-subtract operation on quad-precision floating-point numbers. Ensure that the VSX (Vector Scalar Extensions) are enabled in the MSR register to avoid an exception. Be cautious of rounding modes and exceptions, as they can affect the result and set flags in the FPSCR register. This instruction operates on 128-bit aligned data in vector registers VSR[VRA+32], VSR[VRT+32], and VSR[VRB+32].

Example

xsmsubqp v1, v2, v3

Encoding

Binary Layout
18
0
VRT
6
VRA
11
VRB
16
RO
21
 
Format X-form
Opcode 0xFC000348
Extension VSX
Registers Altered FPSCR

Operands

  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register