Created
December 5, 2011 03:11
-
-
Save enukane/1432135 to your computer and use it in GitHub Desktop.
AESNI support detect test code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int _ecx = 0; | |
int is_aes = 0; | |
int is_avx = 0; | |
asm ( "movl $1, %eax;" ); | |
asm ( "movl $0, %ecx;" ); | |
asm ( "cpuid;" ); | |
asm ( "movl %%ecx, %0;" | |
: "=r"(_ecx) | |
: | |
: "%ecx" | |
); | |
printf("ecx = %x\n", _ecx); | |
is_aes = _ecx & 0x2000000; | |
is_avx = _ecx & 0x10000000; | |
printf("is_aex = %d, is_avx = %d\n", is_aes, is_avx); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment