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 APPLICATIONSCode in the Example 5-8 unpacks two packed-word sources in a non-interleavedway. The goal is to use the instruction which unpacks doublewords to a quadword,instead of using the instruction which unpacks words to doublewords.Example 5-8. Unpacking Two Packed-word Sources in Non-interleaved Way Code; Input:; MM0 packed-word source value; MM1 packed-word source value; Output:; MM0 contains the two low-end words of the; original sources, non-interleaved; MM2 contains the two high end words of the; original sources, non-interleaved.movq mm2, mm0 ; copy source1punpckldq mm0, mm1 ; replace the two high-end words; of MMO with two low-end words of; MM1; leave the two low-end words; of MM0 in placepunpckhdq mm2, mm1 ; move two high-end words of MM2; to the two low-end words of MM2;; place the two high-end words of; MM1 in two high-end words of MM25.4.6 Extract WordThe PEXTRW instruction takes the word in the designated MMX register selected bythe two least significant bits of the immediate value <strong>and</strong> moves it to the lower half ofa <strong>32</strong>-bit integer register. See Figure 5-5 <strong>and</strong> Example 5-9.63MM31 0X4 X3 X2 X1R<strong>32</strong>31 00 ..0 X1OM15163Figure 5-5. PEXTRW Instruction5-12

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

Saved successfully!

Ooh no, something went wrong!