re PR target/66954 (function multiversioning fails for target "aes")
authorUros Bizjak <ubizjak@gmail.com>
Tue, 11 Aug 2015 17:53:41 +0000 (19:53 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 11 Aug 2015 17:53:41 +0000 (19:53 +0200)
libgcc/ChangeLog:

PR target/66954
* config/i386/cpuinfo.c (enum processor_features): Add FEATURE_PCLMUL.
(get_available_features): Handle FEATURE_PCLMUL.

gcc/ChangeLog:

PR target/66954
* config/i386/i386.c (get_builtin_code_for_version): Add P_PCLMUL
to enum feature_priority and feature_list.
(fold_builtin_cpu): Add F_PCLMUL to enum processor_features
and isa_names_table.

gcc/testsuite/ChangeLog:

PR target/66954
* g++.dg/ext/mv25.C: New test.

From-SVN: r226784

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/mv25.C [new file with mode: 0644]
libgcc/ChangeLog
libgcc/config/i386/cpuinfo.c

index 7e311106e4a35b60722aab7e6343d9350276ef69..8db5376a13d007d15e92348038858da8e6bb2021 100644 (file)
@@ -1,3 +1,11 @@
+2015-08-11  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66954
+       * config/i386/i386.c (get_builtin_code_for_version): Add P_PCLMUL
+       to enum feature_priority and feature_list.
+       (fold_builtin_cpu): Add F_PCLMUL to enum processor_features
+       and isa_names_table.
+
 2015-08-11  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        * tree-vect-stmts.c (vectorizable_shift): Add missed test on
index 57d874b87d3bf54fff6a350c0bb349913e3042de..caec21880c3f7ae7cb3838bd1bdc00718635ad13 100644 (file)
@@ -34574,6 +34574,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
     P_PROC_SSE4_2,
     P_POPCNT,
     P_AES,
+    P_PCLMUL,
     P_AVX,
     P_PROC_AVX,
     P_BMI,
@@ -34612,6 +34613,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
       {"sse4.2", P_SSE4_2},
       {"popcnt", P_POPCNT},
       {"aes", P_AES},
+      {"pclmul", P_PCLMUL},
       {"avx", P_AVX},
       {"bmi", P_BMI},
       {"fma4", P_FMA4},
@@ -35600,6 +35602,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
     F_BMI,
     F_BMI2,
     F_AES,
+    F_PCLMUL,
     F_MAX
   };
 
@@ -35696,7 +35699,8 @@ fold_builtin_cpu (tree fndecl, tree *args)
       {"avx512f",F_AVX512F},
       {"bmi",    F_BMI},
       {"bmi2",   F_BMI2},
-      {"aes",    F_AES}
+      {"aes",    F_AES},
+      {"pclmul", F_PCLMUL}
     };
 
   tree __processor_model_type = build_processor_model_struct ();
index 93cacfb9bf2aa7d15f91f7cdf4666f7f51ae9314..5c970e70c8a6aaeb9b67e5240ae6578a6b6ad44d 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-11  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66954
+       * g++.dg/ext/mv25.C: New test.
+
 2015-08-11  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        * gcc.target/i386/avx2-vect-shift.c: New test.
diff --git a/gcc/testsuite/g++.dg/ext/mv25.C b/gcc/testsuite/g++.dg/ext/mv25.C
new file mode 100644 (file)
index 0000000..fd40eca
--- /dev/null
@@ -0,0 +1,35 @@
+// Test case to check if Multiversioning works for PCLMUL
+
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-require-ifunc "" }
+// { dg-options "-O2" }
+
+#include <assert.h>
+
+// Check if PCLMUL feature selection works
+int foo () __attribute__((target("default")));
+int foo () __attribute__((target("pclmul")));
+
+int main ()
+{
+  int val = foo ();
+
+  if (__builtin_cpu_supports ("pclmul"))
+    assert (val == 1);
+  else
+    assert (val == 0);
+
+  return 0;
+}
+
+int __attribute__ ((target("default")))
+foo ()
+{
+  return 0;
+}
+
+int __attribute__ ((target("pclmul")))
+foo ()
+{
+  return 1;
+}
index 95a10f223488f8e9621e7c8f53970789130e264c..062bbe924dd0b2f5f55f916d240b0037babc6d4f 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-11  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66954
+       * config/i386/cpuinfo.c (enum processor_features): Add FEATURE_PCLMUL.
+       (get_available_features): Handle FEATURE_PCLMUL.
+
 2015-08-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/cpuinfo.c (get_intel_cpu): Treat model == 0x4f as
index 57711d01bea8f91770313cf1e5f1b4cb9b360e5b..25d85e4bedd7542353b2480c0636d92e2464dec0 100644 (file)
@@ -101,7 +101,8 @@ enum processor_features
   FEATURE_AVX512F,
   FEATURE_BMI,
   FEATURE_BMI2,
-  FEATURE_AES
+  FEATURE_AES,
+  FEATURE_PCLMUL
 };
 
 struct __processor_model
@@ -277,6 +278,8 @@ get_available_features (unsigned int ecx, unsigned int edx,
     features |= (1 << FEATURE_POPCNT);
   if (ecx & bit_AES)
     features |= (1 << FEATURE_AES);
+  if (ecx & bit_PCLMUL)
+    features |= (1 << FEATURE_PCLMUL);
   if (ecx & bit_SSE3)
     features |= (1 << FEATURE_SSE3);
   if (ecx & bit_SSSE3)