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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CONTENTS9.5.3 Streaming Store Instruction Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-109.5.4 FENCE Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-109.5.4.1 SFENCE Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-109.5.4.2 LFENCE Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-119.5.4.3 MFENCE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-119.5.5 CLFLUSH Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-129.6 MEMORY OPTIMIZATION USING PREFETCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-129.6.1 Software-Controlled Prefetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-139.6.2 Hardware Prefetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-139.6.3 Example of Effective Latency Reduction with Hardware Prefetch . . . . . . . . . . . . . . . . 8-149.6.4 Example of Latency Hiding with S/W Prefetch Instruction . . . . . . . . . . . . . . . . . . . . . . . . 8-159.6.5 Software Prefetching Usage Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-179.6.6 Software Prefetch Scheduling Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-179.6.7 Software Prefetch Concatenation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-189.6.8 Minimize Number of Software Prefetches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-209.6.9 Mix Software Prefetch with Computation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-219.6.10 Software Prefetch <strong>and</strong> Cache Blocking Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-229.6.11 Hardware Prefetching <strong>and</strong> Cache Blocking Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-269.6.12 Single-pass versus Multi-pass Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-279.7 MEMORY OPTIMIZATION USING NON-TEMPORAL STORES . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-309.7.1 Non-temporal Stores <strong>and</strong> Software Write-Combining. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-309.7.2 Cache Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-319.7.2.1 Video Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-319.7.2.2 Video Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-319.7.2.3 Conclusions from Video Encoder <strong>and</strong> Decoder Implementation. . . . . . . . . . . . . . . . . 8-<strong>32</strong>9.7.2.4 Optimizing Memory Copy Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-<strong>32</strong>9.7.2.5 TLB Priming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-339.7.2.6 Using the 8-byte Streaming Stores <strong>and</strong> Software Prefetch. . . . . . . . . . . . . . . . . . . . 8-349.7.2.7 Using 16-byte Streaming Stores <strong>and</strong> Hardware Prefetch. . . . . . . . . . . . . . . . . . . . . . 8-349.7.2.8 Performance Comparisons of Memory Copy Routines . . . . . . . . . . . . . . . . . . . . . . . . . 8-369.7.3 Deterministic Cache Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-379.7.3.1 Cache Sharing Using Deterministic Cache Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 8-399.7.3.2 Cache Sharing in Single-Core or Multicore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-399.7.3.3 Determine Prefetch Stride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-39CHAPTER 9<strong>64</strong>-BIT MODE CODING GUIDELINES9.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19.2 CODING RULES AFFECTING <strong>64</strong>-BIT MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19.2.1 Use Legacy <strong>32</strong>-Bit Instructions When Data Size Is <strong>32</strong> Bits . . . . . . . . . . . . . . . . . . . . . . . . . 9-19.2.2 Use Extra Registers to Reduce Register Pressure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-29.2.3 Use <strong>64</strong>-Bit by <strong>64</strong>-Bit Multiplies To Produce 128-Bit Results Only When Necessary . 9-29.2.4 Sign Extension to Full <strong>64</strong>-Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-29.3 ALTERNATE CODING RULES FOR <strong>64</strong>-BIT MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-39.3.1 Use <strong>64</strong>-Bit Registers Instead of Two <strong>32</strong>-Bit Registers for <strong>64</strong>-Bit Arithmetic. . . . . . . . 9-39.3.2 CVTSI2SS <strong>and</strong> CVTSI2SD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-49.3.3 Using Software Prefetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5PAGEx

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

Saved successfully!

Ooh no, something went wrong!