vcmpbfp

Vector Compare Bounds Floating-Point

vcmpbfp VRT,VRA,VRB
vcmpbfp. VRT,VRA,VRB

Compares two VSRs word element by word and sets the target VSR if Rc=1.

Details

The Vector Compare Bounds Floating-Point instruction compares each single-precision floating-point value in VSR[VRA+32] with the corresponding value in VSR[VRB+32]. It sets the target VSR based on whether the elements are within the bounds specified by the corresponding element in VSR[VRB+32]. If Rc=1, CR Field 6 is set to indicate if all four elements in VSR[VRA+32] are within the bounds.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 3
    src1 ← VSR[VRA+32].word[i]
    src2 ← VSR[VRB+32].word[i]
    le ← bool_COMPARE_LE_BFP32(src1,src2)
    ge ← bool_COMPARE_GE_BFP32(src1,src2)
    VSR[VRT+32].word[i] ← ¬le || ¬ge || 300
end
if Rc=1 then do
    ib ← (VSR[VRT+32]=0)
    CR6 ← 0b00 || ib || 0b0
end

Programming Note

Each single-precision floating-point value in VSR[VRB+32] should be non-negative; if it is negative, the corresponding element in VSR[VRA+32] will necessarily be out of bounds. One exception to this is when the value of an element in VSR[VRB+32] is −0.0 and the value of the corresponding element in VSR[VRA+32] is either +0.0 or −0.0. +0.0 and −0.0 compare equal to −0.0.

Example

vcmpbfp v1, v2, v3

Encoding

Binary Layout
4
0
VRT
6
VRA
11
VRB
16
Rc
21
966
22
 
Format VC-form
Opcode 0x100003C6
Extension VMX (AltiVec)
Registers Altered CR6

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register