![Intel ARCHITECTURE IA-32 Reference Manual Download Page 227](http://html1.mh-extra.com/html/intel/architecture-ia-32/architecture-ia-32_reference-manual_2073155227.webp)
Optimizing for SIMD Integer Applications
4
4-7
Signed Unpack
Signed numbers should be sign-extended when unpacking the values.
This is similar to the zero-extend shown above except that the
psrad
instruction (packed shift right arithmetic) is used to effectively sign
extend the values. Example 4-3 assumes the source is a packed-word
(16-bit) data type.
Example 4-2
Unsigned Unpack Instructions
; Input:
;
MM0
source value
;
MM7 0
a local variable can be used
;
instead of the register MM7 if
;
desired.
; Output:
;
MM0
two zero-extended 32-bit
;
doublewords from two low-end
;
words
;
MM1
two zero-extended 32-bit
;
doublewords from two high-end
;
words
movq
MM1, MM0
; copy source
punpcklwd
MM0, MM7
; unpack the 2 low-end words
; into two 32-bit doubleword
punpckhwd
MM1, MM7
; unpack the 2 high-end words
; into two 32-bit doublewords
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...