packed-subtract instructions with unsigned saturation, thus this
technique can only be used on packed-bytes and packed-words data
types.
The example illustrates the operation on word values.
Example 4-22 Clipping to an Arbitrary Unsigned Range [high, low]
; Input:
;
MM0
; Output:
;
MM1
;
paddusw
MM0, 0xffff - high
psubusw
MM0, (0xffff - high + low)
paddw
MM0, low
Packed Max/Min of Signed Word and Unsigned Byte
Signed Word
The
pmaxsw
words in either two SIMD registers, or one SIMD register and a
memory location.
The
pminsw
words in either two SIMD registers, or one SIMD register and a
memory location.
unsigned source operands
unsigned operands clipped to the unsigned
range [HIGH, LOW]
; in effect this clips to high
; in effect this clips to low
; undo the previous two offsets
instruction returns the maximum between the four signed
instruction returns the minimum between the four signed
Optimizing for SIMD Integer Applications
4
4-29