Checking For Streaming Simd Extensions 2 Support; Example 3-4 Identification Of Sse2 With Cpuid - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

Checking for Streaming SIMD Extensions 2 Support

Checking for support of SSE2 is like checking for SSE support. You
must also check whether your operating system (OS) supports SSE. The
OS requirements for SSE2 Support are the same as the requirements for
SSE.
To check whether your system supports SSE2, follow these steps:
1.
Check that your processor has the
2.
Check the feature bits of
3.
Check for OS support for SSE.
Example 3-4 shows how to find the SSE2 feature bit (bit 26) in the
feature flags.
cpuid
Example 3-4
Identification of SSE2 with cpuid
...identify existence of cpuid instruction
...
mov eax, 1
cpuid
test EDX, 004000000h
jnz
SSE2 requires the same support from the operating system as SSE. To
find out whether the operating system supports SSE2, execute an SSE2
instruction and trap for an exception if one occurs. Catching the
exception in a simple try/except clause (using structured exception
handling in C++) and checking whether the exception code is an invalid
opcode will give you the answer. See Example 3-5.
cpuid
; identify signature is genuine intel
; request for feature flags
; 0Fh, 0A2h
; bit 26 in feature flags equal to 1
Found
Coding for SIMD Architectures
instruction.
cpuid
for SSE2 technology existence.
cpuid instruction
3
3-5

Advertisement

Table of Contents
loading

Table of Contents