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.

CODING FOR SIMD ARCHITECTURES4.1.1 Checking for MMX Technology SupportIf MMX technology is available, then CPUID.01H:EDX[BIT 23] = 1. Use the codesegment in Example 4-1 to test for MMX technology.Example 4-1. Identification of MMX Technology with CPUID…identify existence of cpuid instruction… ;…; Identify signature is genuine Intel… ;mov eax, 1; Request for feature flagscpuid; 0FH, 0A2H CPUID instructiontest edx, 00800000h ; Is MMX technology bit (bit 23) in feature flags equal to 1jnz FoundFor more information on CPUID see, Intel ® Processor Identification with CPUIDInstruction, order number 241618.4.1.2 Checking for Streaming SIMD Extensions SupportChecking for processor support of Streaming SIMD Extensions (SSE) on yourprocessor is similar to checking for MMX technology. However, operating system (OS)must provide support for SSE states save <strong>and</strong> restore on context switches to ensureconsistent application behavior when using SSE instructions.To check whether your system supports SSE, follow these steps:1. Check that your processor supports the CPUID instruction.2. Check the feature bits of CPUID for SSE existence.Example 4-2 shows how to find the SSE feature bit (bit 25) in CPUID feature flags.Example 4-2. Identification of SSE with CPUID…Identify existence of cpuid instruction; Identify signature is genuine intelmov eax, 1; Request for feature flagscpuid; 0FH, 0A2H cpuid instructiontest EDX, 002000000h ; Bit 25 in feature flags equal to 1jnz Found4-2

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

Saved successfully!

Ooh no, something went wrong!