aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-05-14 17:53:58 +0200
committerUros Bizjak <uros@gcc.gnu.org>2018-05-14 17:53:58 +0200
commit9c1326aa5f8031cb37fc6efb9a1e373aa50ffd48 (patch)
treee01d8b22bf6a56b33c93e5ee0f9722121e54ff3d /gcc/testsuite/gcc.c-torture
parentcd2f262b2fa4292a39b97ab590b46e79d349817c (diff)
downloadgcc-9c1326aa5f8031cb37fc6efb9a1e373aa50ffd48.zip
gcc-9c1326aa5f8031cb37fc6efb9a1e373aa50ffd48.tar.gz
gcc-9c1326aa5f8031cb37fc6efb9a1e373aa50ffd48.tar.bz2
re PR target/85756 (wrong code at -Os on x86-64-linux-gnu in 32-bit mode)
PR target/85756 * config/i386/i386.md: Disallow non-commutative arithmetics in last twpeephole for mem {+,-,&,|,^}= x; mem != 0 after cmpelim optimization. Use COMMUTATIVE_ARITH_P test rather than != MINUS in the peephole2 before it. testsuite/ChangeLog: * gcc.c-torture/execute/pr85756.c: New test. From-SVN: r260231
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr85756.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85756.c b/gcc/testsuite/gcc.c-torture/execute/pr85756.c
new file mode 100644
index 0000000..8c95966
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr85756.c
@@ -0,0 +1,50 @@
+/* PR target/85756 */
+
+#if __CHAR_BIT__ == 8 && __SIZEOF_SHORT__ == 2 && __SIZEOF_INT__ == 4
+int a, c, *e, f, h = 10;
+short b;
+unsigned int p;
+
+__attribute__((noipa)) void
+bar (int a)
+{
+ asm volatile ("" : : "r" (a) : "memory");
+}
+
+void
+foo ()
+{
+ unsigned j = 1, m = 430523;
+ int k, n = 1, *l = &h;
+lab:
+ p = m;
+ m = -((~65535U | j) - n);
+ f = b << ~(n - 8);
+ n = (m || b) ^ f;
+ j = p;
+ if (p < m)
+ *l = k < 3;
+ if (!n)
+ l = &k;
+ if (c)
+ {
+ bar (a);
+ goto lab;
+ }
+ if (!*l)
+ *e = 1;
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif