Signed Unpack - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

Example 4-2
Unsigned Unpack Instructions
; Input:
;
;
;
;
; Output:
;
;
;
;
;
;
movq
punpcklwd
punpckhwd

Signed Unpack

Signed numbers should be sign-extended when unpacking the values.
This is similar to the zero-extend shown above except that the
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.
MM0
source value
MM7 0
a local variable can be used
instead of the register MM7 if
desired.
MM0
two zero-extended 32-bit
doublewords from two low-end
words
MM1
two zero-extended 32-bit
doublewords from two high-end
words
MM1, MM0
; copy source
MM0, MM7
; unpack the 2 low-end words
; into two 32-bit doubleword
MM1, MM7
; unpack the 2 high-end words
; into two 32-bit doublewords
Optimizing for SIMD Integer Applications
4
psrad
4-7

Advertisement

Table of Contents
loading

Table of Contents