13.07.2015 Views

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

OPTIMIZING FOR SIMD INTEGER APPLICATIONSExample 5-16. Reverse Code, Using 3 Instructions/* Goal: Reverse the order of the words *//* Instruction Result */| 7| 6| 5| 4| 3| 2| 1| 0|PSHUFLW (0,1,2,3)| 7| 6| 5| 4| 0| 1| 2| 3|PSHUFHW (0,1,2,3)| 4| 5| 6| 7| 0| 1| 2| 3|PSHUFD (1,0,3,2) | 0| 1| 2| 3| 4| 5| 6| 7|5.4.11 Shuffle BytesSSSE3 provides PSHUFB; this instruction carries out byte manipulation within a 16byte range. PSHUFB can replace up to 12 other instructions: including SHIFT, OR,AND <strong>and</strong> MOV.Use PSHUFB if the alternative uses 5 or more instructions.5.4.12 Unpacking/interleaving <strong>64</strong>-bit Data in 128-bit RegistersThe PUNPCKLQDQ/PUNPCHQDQ instructions interleave the low/high-order <strong>64</strong>-bits ofthe source oper<strong>and</strong> <strong>and</strong> the low/high-order <strong>64</strong>-bits of the destination oper<strong>and</strong>. Itthen writes the results to the destination register.The high/low-order <strong>64</strong>-bits of the source oper<strong>and</strong>s are ignored.5.4.13 Data MovementThere are two additional instructions to enable data movement from <strong>64</strong>-bit SIMDinteger registers to 128-bit SIMD registers.The MOVQ2DQ instruction moves the <strong>64</strong>-bit integer data from an MMX register(source) to a 128-bit destination register. The high-order <strong>64</strong> bits of the destinationregister are zeroed-out.The MOVDQ2Q instruction moves the low-order <strong>64</strong>-bits of integer data from a128-bit source register to an MMX register (destination).5.4.14 Conversion InstructionsSSE provides Instructions to support 4-wide conversion of single-precision datato/from double-word integer data. Conversions between double-precision data <strong>and</strong>double-word integer data have been added in SSE2.5-18

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

Saved successfully!

Ooh no, something went wrong!