Skip to content

Instantly share code, notes, and snippets.

@enukane
Created December 5, 2011 03:11
Show Gist options
  • Save enukane/1432135 to your computer and use it in GitHub Desktop.
Save enukane/1432135 to your computer and use it in GitHub Desktop.
AESNI support detect test code
#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