Move byte mask to integer, Move byte mask to integer -16, Example 4-9 – Intel ARCHITECTURE IA-32 User Manual
Page 236: Repeated pinsrw instruction code -16
![background image](/manuals/127794/236/background.png)
IA-32 Intel® Architecture Optimization
4-16
Move Byte Mask to Integer
The
pmovmskb
instruction returns a bit mask formed from the most
significant bits of each byte of its source operand. When used with the
64-bit MMX registers, this produces an 8-bit mask, zeroing out the
upper 24 bits in the destination register. When used with the 128-bit
XMM registers, it produces a 16-bit mask, zeroing out the upper 16 bits
in the destination register. The 64-bit version is shown in Figure 4-7 and
Example 4-10.
Example 4-9
Repeated pinsrw Instruction Code
; Input:
;
edx
pointer to structure containing source
;
values at offsets: of +0, +10, +13, and +24
;
immediate value: “1”
; Output:
;
MMX
register with new 16-bit value inserted
;
pxor
mm0, mm0
; Breaks dependedncy on previous value of mm0
mov
eax, [edx]
pinsrw
mm0, eax, 0
mov
eax, [edx+10]
pinsrw
mm0, eax, 1
mov
eax, [edx+13]
pinsrw
mm0, eax, 2
mov
eax, [edx+24]
pinsrw
mm0, eax, 3