03.03.2013 Views

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPLICATION PROGRAMMING MODEL<br />

}<br />

and eax, 06H<br />

cmp eax, 06H; check OS has enabled both XMM and YMM state support<br />

jne not_supported<br />

mov eax, 1<br />

jmp done<br />

NOT_SUPPORTED:<br />

mov eax, 0<br />

done:<br />

INT supports_VPCLMULQDQ()<br />

{ ; result in eax<br />

mov eax, 1<br />

cpuid<br />

and ecx, 018000002H<br />

cmp ecx, 018000002H; check OSXSAVE, AVX and PCLMULQDQ feature flags<br />

jne not_supported<br />

; processor supports AVX and VPCLMULQDQ instructions and XGETBV is enabled by OS<br />

mov ecx, 0; specify 0 for XFEATURE_ENABLED_MASK register<br />

XGETBV; result in EDX:EAX<br />

and eax, 06H<br />

cmp eax, 06H; check OS has enabled both XMM and YMM state support<br />

jne not_supported<br />

mov eax, 1<br />

jmp done<br />

NOT_SUPPORTED:<br />

mov eax, 0<br />

done:<br />

}<br />

-------------------------------------------------------------------------------<br />

2.2.3 Detection of AVX2<br />

Hardware support for AVX2 is indicated by CPUID.(EAX=07H, ECX=0H):EBX.AVX2[bit 5]=1.<br />

Application Software must identify that hardware supports AVX as explained in Section 2.2, after that it must also<br />

detect support for AVX2 by checking CPUID.(EAX=07H, ECX=0H):EBX.AVX2[bit 5]. The recommended<br />

pseudocode sequence for detection of AVX2 is:<br />

----------------------------------------------------------------------------------------<br />

INT supports_avx2()<br />

{ ; result in eax<br />

mov eax, 1<br />

cpuid<br />

and ecx, 018000000H<br />

cmp ecx, 018000000H; check both OSXSAVE and AVX feature flags<br />

2-4 Ref. # 319433-014

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

Saved successfully!

Ooh no, something went wrong!