+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
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}