< previous page page_434 next page >

Page 434
0434-01.gif
Figure 7.9
Types of vector operations and some examples.
(a) Vector operation: VR OP VR -> VR
d87111c01013bcda00bb8640fdff6754.gif
VADD
d87111c01013bcda00bb8640fdff6754.gif
VSUB
d87111c01013bcda00bb8640fdff6754.gif
VMPY
d87111c01013bcda00bb8640fdff6754.gif
VDIV
d87111c01013bcda00bb8640fdff6754.gif
VAND
d87111c01013bcda00bb8640fdff6754.gif
VOR
d87111c01013bcda00bb8640fdff6754.gif
VEOR
(b) Compare (VCOMP): VR VCOMP VR -> Scalar
d87111c01013bcda00bb8640fdff6754.gif
V1 VCOMP V2 -> S
d87111c01013bcda00bb8640fdff6754.gif
S(i) bit is ''1" if V1.i > V2.i
Test (VTEST): V1 VTEST CC ->Scalar
d87111c01013bcda00bb8640fdff6754.gif
S(i) bit is "1" if V1.i satisfies CC
d87111c01013bcda00bb8640fdff6754.gif
CC is the condition code specified in the instruction
Accumulate (VACC): VACC: S (V1 * V2) -> S1
d87111c01013bcda00bb8640fdff6754.gif
VR VACC VR -> Scalar
(d) Expand/compress
(VEXP/VCPRS): VR OP S -> VR
Expand : Suppose S = 1 0 1 0
d87111c01013bcda00bb8640fdff6754.gif
V1=1.1, 1.2, 1.3, 1.4
d87111c01013bcda00bb8640fdff6754.gif
then V1 VEXP S = 1.1, 0, 1.2, 0,
Compress : Suppose S = 1 0 1 0
d87111c01013bcda00bb8640fdff6754.gif
V1=1.1, 1.2, 1.3, 1.4
d87111c01013bcda00bb8640fdff6754.gif
then V1 VCPRS S = 1.1, 1.3,
Finally, there are vector expand and compress operations, which take logical vectors and apply them to elements in vector registers to create a new vector value (see Figure 7.9). The expand and compress operations are taken from the APL language [146], where they were originally introduced.
When a vector operation is done on two vector registers that contain contents of unequal length, some convention must be established for producing the result. The obvious convention is to specify a vector length in each vector instruction. An alternative specifies that the unused elements of the vector contain zero, the zero is applied to the other vector element, and the result is as defined. Another convention (Figure 7.10) is to establish the invalid contents symbol for all entries in a vector register that have not been explicitly stored into. This is akin to NAN in the IEEE floating-point standard, and the result is also NAN regardless of what the contents of the other register were.

 
< previous page page_434 next page >