Example 3-6 Identification Of Sse3 With Cpuid - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

Example 3-6
Identification of SSE3 with cpuid
...identify existence of cpuid instruction
...
mov eax, 1
cpuid
test ECX, 000000001h
jnz
SSE3 requires the same support from the operating system as SSE. To
find out whether the operating system supports SSE3 (FISTTP and 10 of
the SIMD instructions in SSE3), execute an SSE3 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-7.
Detecting the availability of MONITOR and MWAIT instructions
can be done using a code sequence similar to Example 3-6, the
availability of MONITOR and MWAIT is indicated by bit 3 of the
returned value in ECX.
Software must check for support of MONITOR and MWAIT before
attempting to use MONITOR and MWAIT. Checking for support of
MONITOR and MWAIT can be done by executing the MONITOR
execution and trap for an exception similar to the sequence shown in
Example 3-7.
; identify signature is genuine intel
; request for feature flags
; 0Fh, 0A2h
; bit 0 in feature flags equal to 1
Found
Coding for SIMD Architectures
cpuid instruction
3
3-7

Advertisement

Table of Contents
loading

Table of Contents