OSDN Git Service

PR target/50740
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Oct 2011 14:32:32 +0000 (14:32 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Oct 2011 14:32:32 +0000 (14:32 +0000)
* config/i386/driver-i386.c (host_detect_local_cpu): Do cpuid 7 only
if max_level allows that.

testsuite/ChangeLog:

PR target/50740
* gcc.target/i386/avx2-check.h (main): Check CPUID level correctly.
* gcc.target/i386/bmi2-check.h: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180304 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/driver-i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx2-check.h
gcc/testsuite/gcc.target/i386/bmi2-check.h

index 16da4d6..86658cb 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-21  H.J. Lu  <hongjiu.lu@intel.com>
+           Kirill Yukhin  <kirill.yukhin@intel.com>
+
+       * config/i386/driver-i386.c (host_detect_local_cpu): Do cpuid 7 only
+       if max_level allows that.
+
 2011-10-21  Bernd Schmidt  <bernds@codesourcery.com>
 
        * reg-notes.def (DEP_CONTROL): New.
 2011-10-21  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c (dump_cgraph_node): Dump alias flag.
-       * cgraphunit.c (handle_alias_pairs): Handle weakrefs with no destination.
+       * cgraphunit.c (handle_alias_pairs): Handle weakrefs with
+       no destination.
        (get_alias_symbol): New function.
        (output_weakrefs): Output also weakrefs with no destinatoin.
        (lto_output_node): Output weakref alias flag when at function boundary.
 2011-10-21  Andrew Stubbs  <ams@codesourcery.com>
 
        PR target/50809
-
        * config/arm/driver-arm.c (vendors): Make static.
 
 2011-10-21  Uros Bizjak  <ubizjak@gmail.com>
index 8107ece..5f14c76 100644 (file)
@@ -451,6 +451,15 @@ const char *host_detect_local_cpu (int argc, const char **argv)
   has_sse = edx & bit_SSE;
   has_sse2 = edx & bit_SSE2;
 
+  if (max_level >= 7)
+    {
+      __cpuid_count (7, 0, eax, ebx, ecx, edx);
+
+      has_bmi = ebx & bit_BMI;
+      has_avx2 = ebx & bit_AVX2;
+      has_bmi2 = ebx & bit_BMI2;
+    }
+
   /* Check cpuid level of extended features.  */
   __cpuid (0x80000000, ext_level, ebx, ecx, edx);
 
@@ -470,12 +479,6 @@ const char *host_detect_local_cpu (int argc, const char **argv)
       has_longmode = edx & bit_LM;
       has_3dnowp = edx & bit_3DNOWP;
       has_3dnow = edx & bit_3DNOW;
-
-      __cpuid (0x7, eax, ebx, ecx, edx);
-
-      has_bmi = ebx & bit_BMI;
-      has_avx2 = ebx & bit_AVX2;
-      has_bmi2 = ebx & bit_BMI2;
     }
 
   if (!arch)
index a1b2752..ef34046 100644 (file)
@@ -1,3 +1,10 @@
+2011-10-21  H.J. Lu  <hongjiu.lu@intel.com>
+           Kirill Yukhin  <kirill.yukhin@intel.com>
+
+       PR target/50740
+       * gcc.target/i386/avx2-check.h (main): Check CPUID level correctly.
+       * gcc.target/i386/bmi2-check.h: Ditto.
+
 2011-10-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        PR c++/50811
index 22c9b39..424335d 100644 (file)
@@ -21,6 +21,9 @@ main ()
   /* Run AVX2 test only if host has AVX2 support.  */
   if ((ecx & bit_OSXSAVE) == (bit_OSXSAVE))
     {
+      if (__get_cpuid_max (0, NULL) < 7)
+       return 0;
+
       __cpuid_count (7, 0, eax, ebx, ecx, edx);
 
       if ((avx_os_support ()) && ((ebx & bit_AVX2) == bit_AVX2))
index 5ffce44..c933a49 100644 (file)
@@ -17,6 +17,9 @@ main ()
 {
   unsigned int eax, ebx, ecx, edx;
 
+  if (__get_cpuid_max (0, NULL) < 7)
+    return 0;
+
   __cpuid_count (7, 0,  eax, ebx, ecx, edx);
 
   /* Run BMI2 test only if host has BMI2 support.  */