fix avx2 detection

reword commits to make it clearer
This commit is contained in:
Guillaume Horel
2020-10-31 10:00:48 -04:00
parent 17c46bf06a
commit 1f564d729b
2 changed files with 14 additions and 14 deletions
+6 -6
View File
@@ -330,8 +330,8 @@ int support_avx2(){
if (!support_avx())
return 0;
cpuid(7, &eax, &ebx, &ecx, &edx);
if((ebx & (1<<7)) != 0)
ret=1; //OS supports AVX2
if((ebx & (1<<5)) != 0)
ret=1; //AVX2 flag is set
return ret;
#else
return 0;
@@ -346,13 +346,13 @@ int support_avx512(){
if (!support_avx())
return 0;
cpuid(7, &eax, &ebx, &ecx, &edx);
if((ebx & (1<<7)) == 0){
ret=0; //OS does not even support AVX2
if((ebx & (1<<5)) == 0){
ret=0; //cpu does not have avx2 flag
}
if((ebx & (1u<<31)) != 0){
if((ebx & (1<<31)) != 0){ //AVX512VL flag is set
xgetbv(0, &eax, &edx);
if((eax & 0xe0) == 0xe0)
ret=1; //OS supports AVX512VL
ret=1; //OS supports saving zmm register
}
return ret;
#else