
Chapter 2. Programming Model
2-81
AltiVec UISA Instructions
2.5.5.1 Vector Pack Instructions
Half-word vector pack instructions (
vpkuhum
,
vpkuhus
,
vpkshus
,
vpkshss
) truncate the
sixteen half words from two concatenated source operands producing a single result of
sixteen bytes (quad word) using either modulo (2
8
), 8-bit signed-saturation, or 8-bit
unsigned-saturation to perform the truncation. Similarly, word vector pack instructions
(
vpkuwum
,
vpkuwus
,
vpkswus
,
vpksws
) truncate the eight words from two concatenated
source operands producing a single result of eight half words using modulo (2
16
), 16-bit
signed-saturation, or 16-bit unsigned-saturation to perform the truncation.
Table 2-72 describes the vector pack instructions.
2.5.5.2 Vector Unpack Instructions
Byte vector unpack instructions unpack the 8 low bytes (or 8 high bytes) of one source
operand into 8 half words using sign extension to Tll the most-signiTcant bytes (MSBs).
Half word vector unpack instructions unpack the 4 low half words (or 4 high half words) of
one source operand into 4 words using sign extension to Tll the MSBs.
Two special purpose forms of vector unpack are providedthe Vector Unpack Low Pixel
(
vupklpx
) and the Vector Unpack High Pixel (
vupkhpx
) instructions
for 1/5/5/5
a
RGB
pixels. The 1/5/5/5 pixel vector unpack, unpacks the four low 1/5/5/5 pixels (or four 1/5/5/5
high pixels) into four 32-bit (8/8/8/8) pixels. The 1-bit
a
element in each pixel is sign
extended to 8 bits, and the 5-bit R, G, and B elements are each zero extended to 8 bits.
Table 2-72. Vector Pack Instructions
Name
Mnemonic
Syntax
Vector Pack Unsigned Integer [h,w]
Unsigned Modulo
vpkuhum
vpkuwum
v
D
, v
A
, v
B
Vector Pack Unsigned Integer [h,w]
Unsigned Saturate
vpkuhus
vpkuwus
v
D
, v
A
, v
B
Vector Pack Signed Integer [h,w]
Unsigned Saturate
vpkshus
vpkswus
v
D
, v
A
, v
B
Vector Pack Signed Integer [h,w]
Unsigned Saturate
vpkshss
vpkswss
v
D
, v
A
, v
B
Vector Pack Pixel
vpkpx
v
D
, v
A
, v
B