
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
Содержание ARCHITECTURE IA-32
Страница 1: ...IA 32 Intel Architecture Optimization Reference Manual Order Number 248966 013US April 2006...
Страница 220: ...IA 32 Intel Architecture Optimization 3 40...
Страница 434: ...IA 32 Intel Architecture Optimization 9 20...
Страница 514: ...IA 32 Intel Architecture Optimization B 60...
Страница 536: ...IA 32 Intel Architecture Optimization C 22...
Страница 560: ...IA 32 Intel Architecture Optimization E 14...