]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't report BMI support when AVX support is missing.
authorMark Wielaard <mark@klomp.org>
Fri, 18 Oct 2013 13:11:05 +0000 (13:11 +0000)
committerMark Wielaard <mark@klomp.org>
Fri, 18 Oct 2013 13:11:05 +0000 (13:11 +0000)
Bug #326113. This is a bit conservative, but it is what the linux kernel
also seems to be doing. If AVX support is missing (because the OS doesn't
save the wide registers), then also don't report supporting BMI.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13656

coregrind/m_machine.c

index 69bd7ac5b2cb6410da48dfc42121a4bd2b55a2b5..c4740327cb6bd22bae61b3fe64710736a3192539 100644 (file)
@@ -868,13 +868,13 @@ Bool VG_(machine_get_hwcaps)( void )
         have_rdtscp = (edx & (1<<27)) != 0; /* True => have RDTSVCP */
      }
 
-     /* Check for BMI1 and AVX2. */
+     /* Check for BMI1 and AVX2. If we have AVX1 (plus OS support). */
      have_bmi = False;
      have_avx2 = False;
-     if (max_basic >= 7) {
+     if (have_avx && max_basic >= 7) {
         VG_(cpuid)(7, 0, &eax, &ebx, &ecx, &edx);
         have_bmi = (ebx & (1<<3)) != 0; /* True => have BMI1 */
-        have_avx2 = have_avx && ((ebx & (1<<5)) != 0); /* True => have AVX2 */
+        have_avx2 = (ebx & (1<<5)) != 0; /* True => have AVX2 */
      }
 
      va         = VexArchAMD64;