03.03.2013 Views

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INSTRUCTION SET REFERENCE<br />

PSHUFD — Shuffle Packed Doublewords<br />

Opcode/<br />

<strong>Instruction</strong><br />

Description<br />

Op/<br />

En<br />

64/32<br />

-bit<br />

Mode<br />

CPUID<br />

Feature<br />

Flag<br />

Description<br />

66 0F 70 /r ib A V/V SSE2 Shuffle the doublewords in xmm2/m128 based on the encoding<br />

in imm8 and store the result in xmm1.<br />

PSHUFD xmm1, xmm2/m128, imm8<br />

VEX.128.66.0F.WIG 70 /r ib A V/V AVX Shuffle the doublewords in xmm2/m128 based on the encoding<br />

in imm8 and store the result in xmm1.<br />

VPSHUFD xmm1, xmm2/m128,<br />

imm8<br />

VEX.256.66.0F.WIG 70 /r ib A V/V AVX2 Shuffle the doublewords in ymm2/m256 based on the encoding<br />

in imm8 and store the result in ymm1.<br />

VPSHUFD ymm1, ymm2/m256,<br />

imm8<br />

<strong>Instruction</strong> Operand Encoding<br />

Op/En Operand 1 Operand 2 Operand 3 Operand 4<br />

A ModRM:reg (w) ModRM:r/m (r) NA NA<br />

Copies doublewords from the source operand and inserts them in the destination operand at the locations selected<br />

with the immediate control operand. Figure 5-4 shows the operation of the 256-bit VPSHUFD instruction and the<br />

encoding of the order operand. Each 2-bit field in the order operand selects the contents of one doubleword location<br />

within a 128-bit lane and copy to the target element in the destination operand. For example, bits 0 and 1 of<br />

the order operand targets the first doubleword element in the low and high 128-bit lane of the destination operand<br />

for 256-bit VPSHUFD. The encoded value of bits 1:0 of the order operand (see the field encoding in Figure 5-4)<br />

determines which doubleword element (from the respective 128-bit lane) of the source operand will be copied to<br />

doubleword 0 of the destination operand.<br />

For 128-bit operation, only the low 128-bit lane are operative. The source operand can be an XMM register or a<br />

128-bit memory location. The destination operand is an XMM register. The order operand is an 8-bit immediate.<br />

Note that this instruction permits a doubleword in the source operand to be copied to more than one doubleword<br />

location in the destination operand.<br />

SRC<br />

X7 X6 X5 X4<br />

DEST Y7 Y6 Y5 Y4<br />

Encoding<br />

of Fields in<br />

ORDER<br />

Operand<br />

00B - X4<br />

01B - X5<br />

10B - X6<br />

11B - X7<br />

ORDER<br />

7 6 5 4 3 2 1 0<br />

X3 X2 X1 X0<br />

Y3 Y2 Y1 Y0<br />

Encoding<br />

of Fields in<br />

ORDER<br />

Operand<br />

Figure 5-4. 256-bit VPSHUFD <strong>Instruction</strong> Operation<br />

00B - X0<br />

01B - X1<br />

10B - X2<br />

11B - X3<br />

5-122 Ref. # 319433-014

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!