]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Check FMA after COMMON_CPUID_INDEX_80000001
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 7 Jun 2016 15:00:21 +0000 (08:00 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 7 Jun 2016 15:00:40 +0000 (08:00 -0700)
Since the FMA4 bit is in COMMON_CPUID_INDEX_80000001 and FMA4 requires
AVX, determine if FMA4 is usable after COMMON_CPUID_INDEX_80000001 is
available and if AVX is usable.

[BZ #20195]
* sysdeps/x86/cpu-features.c (get_common_indeces): Move FMA4
check to ...
(init_cpu_features): Here.

ChangeLog
sysdeps/x86/cpu-features.c

index f006508efdeddd0f891d7f96d94362852fedbfc7..5688d2009feac1af9e5d1e8ca3b6c9965eaa3356 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #20195]
+       * sysdeps/x86/cpu-features.c (get_common_indeces): Move FMA4
+       check to ...
+       (init_cpu_features): Here.
+
 2016-06-07  Carlos O'Donell  <carlos@redhat.com>
 
        [BZ #20214]
index a5fa81f709f34a461eed87d5e79faf6dfa576ea3..9ce4b495a5e2129d8cd1890e2d79224b46e71e77 100644 (file)
@@ -87,10 +87,6 @@ get_common_indeces (struct cpu_features *cpu_features,
          if (CPU_FEATURES_CPU_P (cpu_features, FMA))
            cpu_features->feature[index_arch_FMA_Usable]
              |= bit_arch_FMA_Usable;
-         /* Determine if FMA4 is usable.  */
-         if (CPU_FEATURES_CPU_P (cpu_features, FMA4))
-           cpu_features->feature[index_arch_FMA4_Usable]
-             |= bit_arch_FMA4_Usable;
        }
     }
 }
@@ -230,6 +226,15 @@ init_cpu_features (struct cpu_features *cpu_features)
                 cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].ecx,
                 cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].edx);
 
+      if (HAS_ARCH_FEATURE (AVX_Usable))
+       {
+         /* Since the FMA4 bit is in COMMON_CPUID_INDEX_80000001 and
+            FMA4 requires AVX, determine if FMA4 is usable here.  */
+         if (CPU_FEATURES_CPU_P (cpu_features, FMA4))
+           cpu_features->feature[index_arch_FMA4_Usable]
+             |= bit_arch_FMA4_Usable;
+       }
+
       if (family == 0x15)
        {
 #if index_arch_Fast_Unaligned_Load != index_arch_Fast_Copy_Backward