Optimizing for SIMD Integer Applications
4
4-29
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.
Packed Max/Min of Signed Word and Unsigned Byte
Signed Word
The
pmaxsw
instruction returns the maximum between the four signed
words in either two SIMD registers, or one SIMD register and a
memory location.
The
pminsw
instruction returns the minimum between the four signed
words in either two SIMD registers, or one SIMD register and a
memory location.
Example 4-22 Clipping to an Arbitrary Unsigned Range [high, low]
; Input:
;
MM0
unsigned source operands
; Output:
;
MM1
unsigned operands clipped to the unsigned
;
range [HIGH, LOW]
paddusw
MM0, 0xffff - high
; in effect this clips to high
psubusw
MM0, (0xffff - high + low)
; in effect this clips to low
paddw
MM0, low
; undo the previous two offsets
Summary of Contents for ARCHITECTURE IA-32
Page 1: ...IA 32 Intel Architecture Optimization Reference Manual Order Number 248966 013US April 2006...
Page 220: ...IA 32 Intel Architecture Optimization 3 40...
Page 434: ...IA 32 Intel Architecture Optimization 9 20...
Page 514: ...IA 32 Intel Architecture Optimization B 60...
Page 536: ...IA 32 Intel Architecture Optimization C 22...