Refs #124. Check XSAVE flag on x86 CPU.
authorZhang Xianyi <traits.zhang@gmail.com>
Thu, 6 Jun 2013 14:50:43 +0000 (22:50 +0800)
committerZhang Xianyi <traits.zhang@gmail.com>
Thu, 6 Jun 2013 14:50:43 +0000 (22:50 +0800)
cpuid_x86.c
driver/others/dynamic.c

index 3177746..d66ec5a 100644 (file)
@@ -130,7 +130,7 @@ int support_avx(){
   int ret=0;
   
   cpuid(1, &eax, &ebx, &ecx, &edx);
-  if ((ecx & (1 << 28)) != 0 && (ecx & (1 << 27)) != 0){
+  if ((ecx & (1 << 28)) != 0 && (ecx & (1 << 27)) != 0 && (ecx & (1 << 26)) != 0){
     xgetbv(0, &eax, &edx);
     if((eax & 6) == 6){
       ret=1;  //OS support AVX
index 893dd07..425733a 100644 (file)
@@ -92,7 +92,7 @@ int support_avx(){
   int ret=0;
   
   cpuid(1, &eax, &ebx, &ecx, &edx);
-  if ((ecx & (1 << 28)) != 0 && (ecx & (1 << 27)) != 0){
+  if ((ecx & (1 << 28)) != 0 && (ecx & (1 << 27)) != 0 && (ecx & (1 << 26)) != 0){
     xgetbv(0, &eax, &edx);
     if((eax & 6) == 6){
       ret=1;  //OS support AVX