User Guide
128-Bit Media and Scientific Programming 125
24592—Rev. 3.15—November 2009 AMD64 Technology
Saturation. Saturating (also called limiting or clamping) instructions limit the value of a result to the
maximum or minimum value representable by the applicable data type. Saturating versions of integer
vector-arithmetic instructions operate on byte-sized and word-sized elements. These instructions—for
example, PACKx, PADDSx, PADDUSx, PSUBSx, and PSUBUSx—saturate signed or unsigned data
at the vector-element level when the element reaches its maximum or minimum representable value.
Saturation avoids overflow or underflow errors.
The examples in Table 4-2 illustrate saturating and non-saturating results with word operands.
Saturation for other data-type sizes follows similar rules. Once saturated, the saturated value is treated
like any other value of its type. For example, if 0001h is subtracted from the saturated value, 7FFFh,
the result is 7FFEh.
Arithmetic instructions not specifically designated as saturating perform non-saturating, twos-
complement arithmetic.
Other Fixed-Point Operands. The architecture provides specific support only for integer fixed-point
operands—those in which an implied binary point is always located to the right of bit 0. Nevertheless,
Table 4-1. Range of Values in 128-Bit Media Integer Data Types
Data-Type
Interpretation
Byte Word Doubleword Quadword
Double
Quadword
Unsigned
integers
Base-2
(exact)
0to+2
8
–1 0to+2
16
–1 0to+2
32
–1 0to+2
64
–1 0to+2
128
–1
Base-10
(approx.)
0 to 255 0 to 65,535 0 to 4.29 * 10
9
0to1.84*10
19
0to3.40*10
38
Signed
integers
1
Base-2
(exact)
–2
7
to +(2
7
–1)
–2
15
to
+(2
15
–1)
–2
31
to +(2
31
–1) –2
63
to +(2
63
–1) –2
127
to +(2
127
–1)
Base-10
(approx.)
-128 to +127
-32,768 to
+32,767
-2.14 * 10
9
to
+2.14 * 10
9
–9.22 * 10
18
to +9.22 * 10
18
–1.70 * 10
38
to +1.70 * 10
38
Note:
1. The sign bit is the most-significant bit (bit 7 for a byte, bit 15 for a word, bit 31 for doubleword, bit 63 for quadword,
bit 127 for double quadword.).
Table 4-2. Saturation Examples
Operation
Non-Saturated
Infinitely Precise
Result
Saturated
Signed Result
Saturated
Unsigned Result
7000h + 2000h 9000h 7FFFh 9000h
7000h + 7000h E000h 7FFFh E000h
F000h + F000h 1E000h E000h FFFFh
9000h + 9000h 12000h 8000h FFFFh
7FFFh + 0100h 80FFh 7FFFh 80FFh
7FFFh + FF00h 17EFFh 7EFFh FFFFh