Packed-Data Processing on the ’C64x
8-40
8.2.9
Performing Conditional Operations with Packed Data
The ’C64x provides a set of operations that are intended to provide conditional
data flow in code that operates on packed data. These operations make it pos-
sible to avoid breaking the packed data flow with unpacking code and tradition-
al ’if’ statements.
Common conditional operations, such as
maximum, minimum and absolute
value are addressed directly with their own specialized intrinsics. In addition
to these specific operations, more generalized compare and select operations
can be constructed using the packed compare intrinsics, _cmpXX2 and
_cmpXX4, in conjunction with the expand intrinsics, _xpnd2 and _xpnd4.
The packed compare intrinsics compare packed data elements, producing a
small bitfield which describes the results of the independent comparisons. For
_cmpeq2, _cmpgt2, and _cmplt2, the intrinsic returns a two bit field containing
the results of the two separate comparisons. For _cmpeq4, _cmpgtu4, and
_cmpltu4, the intrinsic returns a four bit field containing the results of the four
separate comparisons. In both sets of intrinsics, a 1 bit signifies that the tested
condition is true, and a 0 signifies that it is false. Figure 8–21 and Figure 8–22
illustrate how these compare intrinsics work.
Figure 8–21. Graphical Illustration of _cmpXX2 Intrinsics
0 0 0 0 0 0 0 0 0 0 0
0
0
0
0 0 0 0 0
0
0
0
0 0 0 0 0 0
0
0
c
The _cmpXX2 operation
a_hi
a_lo
b_hi
b_lo
a
b
c = cmpXX2(a, b)
cmp
cmp