Checking for streaming simd extensions 3 support, Example 3-5, Identification of sse2 by the os -6 – Intel ARCHITECTURE IA-32 User Manual

Page 186

Advertising
background image

IA-32 Intel® Architecture Optimization

3-6

Checking for Streaming SIMD Extensions 3 Support

SSE3 includes 13 instructions, 11 of those are suited for SIMD or x87
style programming. Checking for support of these SSE3 instructions is
similar to checking for SSE support. You must also check whether your
operating system (OS) supports SSE. The OS requirements for SSE3
Support are the same as the requirements for SSE.

To check whether your system supports the x87 and SIMD instructions
of SSE3, follow these steps:

1.

Check that your processor has the

cpuid

instruction.

2.

Check the ECX feature bit 0 of

cpuid

for SSE3 technology

existence.

3.

Check for OS support for SSE.

Example 3-6

shows how to find the SSE3 feature bit (bit 0 of ECX) in

the

cpuid

feature flags.

Example 3-5

Identification of SSE2 by the OS

bool OSSupportCheck() {

_try {

__asm xorpd xmm0, xmm0 ; SSE2}

_except(EXCEPTION_EXECUTE_HANDLER) {

if _exception_code()==STATUS_ILLEGAL_INSTRUCTION)

/* SSE2not supported */

return (false);

}

/* SSE2 are supported by OS */

return (true);

}

Advertising