aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2015-07-22 20:01:33 +0200
committerUros Bizjak <uros@gcc.gnu.org>2015-07-22 20:01:33 +0200
commit54d22142b1c65e95decfb2882934237c53824012 (patch)
treec3118811727c0ff0259af8665464e10d82e8d51f /gcc
parent27c4ac7db7a74a7be0274f05af3e32e2161a6583 (diff)
downloadgcc-54d22142b1c65e95decfb2882934237c53824012.zip
gcc-54d22142b1c65e95decfb2882934237c53824012.tar.gz
gcc-54d22142b1c65e95decfb2882934237c53824012.tar.bz2
re PR target/66954 (function multiversioning fails for target "aes")
libgcc/ChangeLog: PR target/66954 * config/i386/cpuinfo.c (enum processor_features): Add FEATURE_AES. (get_available_features): Handle FEATURE_AES. gcc/ChangeLog: PR target/66954 * config/i386/i386.c (get_builtin_code_for_version): Add P_AES to enum feature_priority and feature_list. (fold_builtin_cpu): Add F_AES to enum processor_features and isa_names_table. gcc/testsuite/ChangeLog: PR target/66954 * g++.dg/ext/mv24.C: New test. From-SVN: r226081
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/mv24.C35
4 files changed, 54 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cf4ecd7..8d22ffc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-07-22 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/66954
+ * config/i386/i386.c (get_builtin_code_for_version): Add P_AES
+ to enum feature_priority and feature_list.
+ (fold_builtin_cpu): Add F_AES to enum processor_features
+ and isa_names_table.
+
2015-07-22 Ilya Enkovich <enkovich.gnu@gmail.com>
PR driver/66737
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b10569a..c9dbe47 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -34611,6 +34611,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
P_SSE4_2,
P_PROC_SSE4_2,
P_POPCNT,
+ P_AES,
P_AVX,
P_PROC_AVX,
P_BMI,
@@ -34627,7 +34628,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
P_PROC_AVX512F
};
- enum feature_priority priority = P_ZERO;
+ enum feature_priority priority = P_ZERO;
/* These are the target attribute strings for which a dispatcher is
available, from fold_builtin_cpu. */
@@ -34648,6 +34649,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
{"sse4.1", P_SSE4_1},
{"sse4.2", P_SSE4_2},
{"popcnt", P_POPCNT},
+ {"aes", P_AES},
{"avx", P_AVX},
{"bmi", P_BMI},
{"fma4", P_FMA4},
@@ -35635,6 +35637,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
F_AVX512F,
F_BMI,
F_BMI2,
+ F_AES,
F_MAX
};
@@ -35730,7 +35733,8 @@ fold_builtin_cpu (tree fndecl, tree *args)
{"avx2", F_AVX2},
{"avx512f",F_AVX512F},
{"bmi", F_BMI},
- {"bmi2", F_BMI2}
+ {"bmi2", F_BMI2},
+ {"aes", F_AES}
};
tree __processor_model_type = build_processor_model_struct ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8bde72f..f457b27 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-22 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/66954
+ * g++.dg/ext/mv24.C: New test.
+
2015-07-22 Marek Polacek <polacek@redhat.com>
* gcc.dg/vmx/unpack.c: Use dg-additional-options rather than
diff --git a/gcc/testsuite/g++.dg/ext/mv24.C b/gcc/testsuite/g++.dg/ext/mv24.C
new file mode 100644
index 0000000..58292a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/mv24.C
@@ -0,0 +1,35 @@
+// Test case to check if Multiversioning works for AES
+
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-require-ifunc "" }
+// { dg-options "-O2" }
+
+#include <assert.h>
+
+// Check if AES feature selection works
+int foo () __attribute__((target("default")));
+int foo () __attribute__((target("aes")));
+
+int main ()
+{
+ int val = foo ();
+
+ if (__builtin_cpu_supports ("aes"))
+ assert (val == 1);
+ else
+ assert (val == 0);
+
+ return 0;
+}
+
+int __attribute__ ((target("default")))
+foo ()
+{
+ return 0;
+}
+
+int __attribute__ ((target("aes")))
+foo ()
+{
+ return 1;
+}