re PR rtl-optimization/89435 (wrong code with -O1 -march=armv4 -fno-forward-propagate...
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Sep 2019 11:37:39 +0000 (13:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 Sep 2019 11:37:39 +0000 (13:37 +0200)
PR rtl-optimization/89435
PR rtl-optimization/89795
PR rtl-optimization/91720
* gcc.dg/pr89435.c: New test.
* gcc.dg/pr89795.c: New test.
* gcc.dg/pr91720.c: New test.

From-SVN: r275642

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr89435.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr89795.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr91720.c [new file with mode: 0644]

index 940be7f8e2f83d886825d4fe40d8d224ab30f1a0..aa3127cf3fdb9b3071fefe27d6123fd31ff96f24 100644 (file)
@@ -1,3 +1,12 @@
+2019-09-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/89435
+       PR rtl-optimization/89795
+       PR rtl-optimization/91720
+       * gcc.dg/pr89435.c: New test.
+       * gcc.dg/pr89795.c: New test.
+       * gcc.dg/pr91720.c: New test.
+
 2019-09-11  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/90387
diff --git a/gcc/testsuite/gcc.dg/pr89435.c b/gcc/testsuite/gcc.dg/pr89435.c
new file mode 100644 (file)
index 0000000..d72d087
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/89435 */
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-forward-propagate -fno-tree-forwprop -fno-tree-ccp" } */
+
+unsigned short a;
+unsigned int b, c, d, e, f;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4
+  unsigned char g = e = __builtin_mul_overflow_p (5, 542624702, 0);
+  d = __builtin_bswap64 (a);
+  b = __builtin_sub_overflow ((unsigned char) -e, (unsigned int) d, &g);
+  e = __builtin_mul_overflow (b, c, &a);
+  f = g + e;
+  if (f != 0xff)
+    __builtin_abort ();
+#endif
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr89795.c b/gcc/testsuite/gcc.dg/pr89795.c
new file mode 100644 (file)
index 0000000..4ceaa43
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/89795 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-dce -fno-forward-propagate -fno-sched-pressure" } */
+
+unsigned char a;
+unsigned b, c, d;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8
+  unsigned x;
+  int e, f;
+  unsigned char g;
+  e = __builtin_bswap32 (a);
+  f = __builtin_ffs (~(unsigned short) e);
+  a = __builtin_mul_overflow ((unsigned char) 0xf7, f, &g);
+  a |= __builtin_sub_overflow_p (c, 0, (unsigned char) 0);
+  d = g + b;
+  x = d;
+  if (x != 0xf7)
+    __builtin_abort ();
+#endif
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr91720.c b/gcc/testsuite/gcc.dg/pr91720.c
new file mode 100644 (file)
index 0000000..4abdace
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR rtl-optimization/91720 */
+/* { dg-do run } */
+/* { dg-options "-Og -fno-forward-propagate -frerun-cse-after-loop -fno-tree-fre" } */
+
+unsigned a, b;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8
+  unsigned c = 1;
+  unsigned long long d = 0;
+  unsigned char e = 0;
+  e = __builtin_sub_overflow (d, e, &a) ? 0 : 0x80;
+  e = e << 7 | e >> c;
+  __builtin_memmove (&d, &a, 2);
+  b = e;
+  if (b != 0x40)
+    __builtin_abort ();
+#endif
+  return 0;
+}