aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-12-08 01:03:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-12-08 01:03:28 +0100
commit5bac1edb4f4c4fc55b90d7034f23c3f4dbec98c0 (patch)
tree1d7f338706aa94682ab2077889fbe1581a0ef3ad
parent7f5aed1e5d7b8f02ed81178f65d84cbd27ec88cd (diff)
downloadgcc-5bac1edb4f4c4fc55b90d7034f23c3f4dbec98c0.zip
gcc-5bac1edb4f4c4fc55b90d7034f23c3f4dbec98c0.tar.gz
gcc-5bac1edb4f4c4fc55b90d7034f23c3f4dbec98c0.tar.bz2
re PR target/83252 (Wrong code with "-march=skylake-avx512 -O3")
PR target/83252 * gcc.target/i386/i386.exp (check_effective_target_bmi2): Moved to ... * lib/target-supports.exp (check_effective_target_bmi2): ... here. Guard with i?86-*-* x86_64-*-*. * g++.dg/opt/pr83252.C: New test. From-SVN: r255487
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/opt/pr83252.C92
-rw-r--r--gcc/testsuite/gcc.target/i386/i386.exp11
-rw-r--r--gcc/testsuite/lib/target-supports.exp14
4 files changed, 112 insertions, 11 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d12ca43..564a301 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2017-12-08 Jakub Jelinek <jakub@redhat.com>
+ PR target/83252
+ * gcc.target/i386/i386.exp (check_effective_target_bmi2): Moved to ...
+ * lib/target-supports.exp (check_effective_target_bmi2): ... here. Guard with
+ i?86-*-* x86_64-*-*.
+ * g++.dg/opt/pr83252.C: New test.
+
PR target/81906
* gcc.target/i386/pr81906.c: New test.
diff --git a/gcc/testsuite/g++.dg/opt/pr83252.C b/gcc/testsuite/g++.dg/opt/pr83252.C
new file mode 100644
index 0000000..835b77f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr83252.C
@@ -0,0 +1,92 @@
+// PR target/83252
+// { dg-do run }
+// { dg-options "-O3" }
+// { dg-additional-options "-mbmi2 -mtune=intel" { target bmi2 } }
+
+#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 && __CHAR_BIT__ == 8
+
+#ifdef __BMI2__
+#include "../../gcc.target/i386/bmi2-check.h"
+#endif
+
+long long h = 707493562598231894LL, i, n, x3, x5;
+long long j, l = -2228108721620697360LL, o, y9;
+int k, p, r, s, t = 2, u, w, z8, x7, y4, y5, y6, y7, y8, x1, x2, x4, x6, d;
+unsigned v, x = 751359462, z = 1, y3 = 60;
+unsigned *y = &x, *z2 = &z, *z3 = &v;
+unsigned long long z1 = 2;
+unsigned long long *z4 = &z1;
+long long *z7;
+unsigned long long z9 = 7091529791657LL;
+
+void
+foo ()
+{
+ if ((-2783342978U * (int) l || z) && z2 && h && z1 && z9 & ~-(-2783342978U * (int) l))
+ {
+ i = 3060393125LL < n;
+ y7 = o >> *y - 751359400;
+ *z3 = x7;
+ long a = (o >> *y - 751359400 >> ~-(-2783342978U * (int) l) - 88480234) - (-2783342978U * (int) l);
+ y6 = a;
+ if (~0 % *z4 % 5)
+ y8 = -3 * (l - 4 ? : 407228174574);
+ if (y3 < 1)
+ {
+ long long *b = &y9;
+ z3 = 0;
+ int c = *z2;
+ *z7 = 0;
+ x1 = ~(-((unsigned) (-2783342978U * (unsigned long long) l)));
+ p = *b & j;
+ x2 = c;
+ }
+ else
+ {
+ j = 0;
+ int e = !0 % (7 % *z4);
+ r = ((s || !k) && t) - -(-2783342978U * (unsigned long long) l);
+ x3 = o >> *y - 751359400;
+ y9 = z9;
+ long f = o >> *y - 751359400 >> ~-(-2783342978U * (int) l) - 88480234;
+ x4 = z1;
+ u = n * f * e * y4;
+ }
+ if (8ULL * -(-(-2783342978U * (int) l)))
+ ;
+ else
+ {
+ *z3 = 0;
+ int g = 3 & y5;
+ x5 = (unsigned) (~o + 9223372036854775807 >> l);
+ z8 = g + y9;
+ v = j || ~0 + 9223372036854775807 >> ~-(-2783342978U * (int) l);
+ x6 = o >> (8 * l);
+ w = *y ? -2783342978U * l : 0;
+ }
+ }
+}
+
+#ifdef __BMI2__
+void
+bmi2_test (void)
+{
+ foo ();
+ if (r != 88480289)
+ __builtin_abort ();
+}
+#else
+int
+main ()
+{
+ foo ();
+ if (r != 88480289)
+ __builtin_abort ();
+}
+#endif
+#else
+int
+main ()
+{
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/i386.exp b/gcc/testsuite/gcc.target/i386/i386.exp
index b446813..c663a12 100644
--- a/gcc/testsuite/gcc.target/i386/i386.exp
+++ b/gcc/testsuite/gcc.target/i386/i386.exp
@@ -207,17 +207,6 @@ proc check_effective_target_bmi { } {
} "-mbmi" ]
}
-# Return 1 if bmi2 instructions can be compiled.
-proc check_effective_target_bmi2 { } {
- return [check_no_compiler_messages bmi2 object {
- unsigned int
- _bzhi_u32 (unsigned int __X, unsigned int __Y)
- {
- return __builtin_ia32_bzhi_si (__X, __Y);
- }
- } "-mbmi2" ]
-}
-
# Return 1 if ADX instructions can be compiled.
proc check_effective_target_adx { } {
return [check_no_compiler_messages adx object {
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ed7d624..ff8c805 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1856,6 +1856,20 @@ proc check_effective_target_avx512f_runtime { } {
return 0
}
+# Return 1 if bmi2 instructions can be compiled.
+proc check_effective_target_bmi2 { } {
+ if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
+ return 0
+ }
+ return [check_no_compiler_messages bmi2 object {
+ unsigned int
+ _bzhi_u32 (unsigned int __X, unsigned int __Y)
+ {
+ return __builtin_ia32_bzhi_si (__X, __Y);
+ }
+ } "-mbmi2" ]
+}
+
# Return 1 if the target supports executing MIPS Paired-Single instructions,
# 0 otherwise. Cache the result.