14.06.2015 Views

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Version</strong> <strong>2.03</strong><br />

5.10.4 Vector Floating-Point Compare Instructions<br />

The Vector Floating-Point Compare instructions compare<br />

two Vector Registers word element by word element,<br />

interpreting the elements as single-precision<br />

floating-point numbers. With the exception of the Vector<br />

Compare Bounds Floating-Point instruction, they set<br />

the target Vector Register, and CR Field 6 if Rc=1, in<br />

the same manner as do the Vector Integer Compare<br />

instructions; see Section 5.9.2.<br />

The Vector Compare Bounds Floating-Point instruction<br />

sets the target Vector Register, and CR Field 6 if Rc=1,<br />

to indicate whether the elements in VRA are within the<br />

bounds specified by the corresponding element in<br />

VRB, as explained in the instruction description. A single-precision<br />

floating-point value x is said to be “within<br />

the bounds” specified by a single-precision floating-point<br />

value y if -y ≤ x ≤ y.<br />

Vector Compare Bounds Single-Precision<br />

VC-form<br />

vcmpbfp VRT,VRA,VRB ( Rc=0 )<br />

vcmpbfp. VRT,VRA,VRB ( Rc=1 )<br />

4 VRT VRA VRB Rc 966<br />

0 6 11 16 21 22 31<br />

do i=0 to 127 by 32<br />

le ( (VRA) i:i+31 ≤ fp (VRB) i:i+31 )<br />

ge ( (VRA) i:i+31 ≥ fp -(VRB) i:i+31 )<br />

VRT i:i+31 ¬le || ¬ge || 30 0<br />

if Rc=1 then do<br />

ib (VRT= 128 0)<br />

CR6 0b00 || ib || 0b0<br />

For each vector element i from 0 to 3, do the following.<br />

Single-precision floating-point word element i in<br />

VRA is compared to single-precision floating-point<br />

word element i in VRB. A 2-bit value is formed that<br />

indicates whether the element in VRA is within the<br />

bounds specified by the element in VRB, as follows.<br />

- Bit 0 of the 2-bit value is set to 0 if the element<br />

in VRA is less than or equal to the element in<br />

VRB, and is set to 1 otherwise.<br />

- Bit 1 of the 2-bit value is set to 0 if the element<br />

in VRA is greater than or equal to the negation<br />

of the element in VRB, and is set to 1 otherwise.<br />

The 2-bit value is placed into the high-order two<br />

bits of word element i of VRT and the remaining<br />

bits of element i are set to 0.<br />

If Rc=1, CR field 6 is set as follows.<br />

Bit Description<br />

0 Set to 0<br />

1 Set to 0<br />

2 Set to indicate whether all four elements in VRA<br />

are within the bounds specified by the corresponding<br />

element in VRB, otherwise set to 0.<br />

3 Set to 0<br />

Special Registers Altered:<br />

CR6<br />

(if Rc=1)<br />

Programming Note<br />

Each single-precision floating-point word element<br />

in VRB should be non-negative; if it is negative, the<br />

corresponding element in VRA will necessarily be<br />

out of bounds.<br />

One exception to this is when the value of an element<br />

in VRB is -0.0 and the value of the corresponding<br />

element in VRA is either +0.0 or -0.0.<br />

+0.0 and -0.0 compare equal to -0.0.<br />

Vector Compare Equal To<br />

Single-Precision<br />

VC-form<br />

vcmpeqfp VRT,VRA,VRB ( Rc=0 )<br />

vcmpeqfp. VRT,VRA,VRB ( Rc=1 )<br />

4 VRT VRA VRB Rc 198<br />

0 6 11 16 21 22 31<br />

do i=0 to 127 by 32<br />

VRT i:i+31 ((VRA) i:i+31 = fp (VRB) i:i+31 ) ? 32 1 : 32 0<br />

if Rc=1 then do<br />

t ( VRT= 128 1 )<br />

f ( VRT= 128 0 )<br />

CR6 t || 0b0 || f || 0b0<br />

For each vector element i from 0 to 3, do the following.<br />

Single-precision floating-point element i in VRA is<br />

compared to single-precision floating-point element<br />

i in VRB. Word element i in VRT is set to all<br />

1s if single-precision floating-point element i in<br />

VRA is equal to single-precision floating-point element<br />

i in VRB, and is set to all 0s otherwise.<br />

If the source element i in VRA or the source element<br />

i in VRB is a NaN, VRT is set to all 0s, indicating<br />

“not equal to”. If the source element i in VRA<br />

and the source element i in VRB are both infinity<br />

with the same sign, VRT is set to all 1s, indicating<br />

“equal to”.<br />

Special Registers Altered:<br />

CR6<br />

(if Rc=1)<br />

Chapter 5. Vector Processor [Category: Vector]<br />

189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!