vcmpgefp

Vector Compare Greater Equal Floating-Point

vcmpgefp vD, vA, vB

Compares 4 floats (A >= B).

Details

The Vector Compare Greater Equal Floating-Point instruction compares two VSRs word element by word, interpreting the elements as single-precision floating-point numbers. It sets the target VSR and CR Field 6 if Rc=1 to indicate whether each element in VSR[VRA+32] is greater than or equal to the corresponding element in VSR[VRB+32].

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
all_true ←1
all_false ←1
do i = 0 to 3
   src1 ←VSR[VRA+32].word[i]
   src2 ←VSR[VRB+32].word[i]
   if bool_COMPARE_GE_BFP32(src1,src2)=1 then
      VSR[VRT+32].word[i] ←0xFFFF_FFFF
      all_false ←0
   else
      VSR[VRT+32].word[i] ←0x0000_0000
      all_true ←0
end
if Rc=1 then
   CR.field[6] ←all_true || 0b0 || all_false || 0b0

Programming Note

This instruction is commonly used for element-wise comparison of single-precision floating-point numbers in vector registers. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. The result of each comparison is stored as 0xFFFFFFFF if true or 0x0000_0000 if false in the target VSR. If Rc=1, CR Field 6 is updated to reflect whether all comparisons were true, all were false, or a mix of both.

Example

vcmpgefp vd, va, vb

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
454
21
 
Format VC-form
Opcode 0x100001C6
Extension VMX (AltiVec)
Registers Altered MSR, CR6

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B