Interleaved Pack Without Saturation; Example 4-4 Interleaved Pack With Saturation - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

IA-32 Intel® Architecture Optimization
Example 4-4
Interleaved Pack with Saturation
; Input:
;
; Output:
;
;
;
;
packssdw
packssdw
punpcklwd
MM0, MM1
The pack instructions always assume that the source operands are
signed numbers. The result in the destination register is always defined
by the pack instruction that performs the operation. For example, the
packssdw
two sources into four saturated 16-bit signed values in the destination
register. The
four signed 16-bit values of the two sources into eight saturated eight-bit
unsigned values in the destination. A complete specification of the
MMX instruction set can be found in the Intel Architecture MMX
Technology Programmer's Reference Manual, order number 243007.

Interleaved Pack without Saturation

Example 4-5 is similar to Example 4-4 except that the resulting words
are not saturated. In addition, in order to protect against overflow, only
the low order 16 bits of each doubleword are used in this operation.
4-10
MM0
signed source1 value
MM1
signed source2 value
MM0
the first and third words contain the
signed-saturated doublewords from MM0,
the second and fourth words contain
signed-saturated doublewords from MM1
MM0, MM0
MM1, MM1
; interleave the low-end 16-bit
; values of the operands
instruction packs each of the two signed 32-bit values of the
instruction, on the other hand, packs each of the
packuswb
; pack and sign saturate
; pack and sign saturate

Advertisement

Table of Contents
loading

Table of Contents