IA-32 Intel® Architecture Optimization
3-4
To find out whether the operating system supports SSE, execute an SSE
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-3.
Example 3-2
Identification of SSE with
cpuid
…identify existence of cpuid instruction
…
; identify signature is genuine intel
mov eax, 1
; request for feature flags
cpuid
; 0Fh, 0A2h cpuid instruction
test EDX, 002000000h
; bit 25 in feature flags equal to 1
jnz
Found
Example 3-3
Identification of SSE by the OS
bool OSSupportCheck() {
_try {
__asm xorps xmm0, xmm0 ;Streaming SIMD Extension
}
_except(EXCEPTION_EXECUTE_HANDLER) {
if (_exception_code()==STATUS_ILLEGAL_INSTRUCTION)
/* SSE not supported */
return (false);
}
/* SSE are supported by OS */
return (true);
}
Summary of Contents for ARCHITECTURE IA-32
Page 1: ...IA 32 Intel Architecture Optimization Reference Manual Order Number 248966 013US April 2006...
Page 220: ...IA 32 Intel Architecture Optimization 3 40...
Page 434: ...IA 32 Intel Architecture Optimization 9 20...
Page 514: ...IA 32 Intel Architecture Optimization B 60...
Page 536: ...IA 32 Intel Architecture Optimization C 22...