Blame SOURCES/gcc48-pr78378.patch

22033d
2017-05-30  Jakub Jelinek  <jakub@redhat.com>
22033d
 
22033d
 	Backported from mainline
22033d
	2016-11-16  Jakub Jelinek  <jakub@redhat.com>
22033d
22033d
	PR rtl-optimization/78378
22033d
	* combine.c (make_extraction): Use force_to_mode for non-{REG,MEM}
22033d
	inner only if pos is 0.
22033d
22033d
	* gcc.c-torture/execute/pr78378.c: New test.
22033d
22033d
--- gcc/combine.c
22033d
+++ gcc/combine.c
22033d
@@ -7342,6 +7342,7 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
22033d
   if (tmode != BLKmode
22033d
       && ((pos_rtx == 0 && (pos % BITS_PER_WORD) == 0
22033d
 	   && !MEM_P (inner)
22033d
+	   && (pos == 0 || REG_P (inner))
22033d
 	   && (inner_mode == tmode
22033d
 	       || !REG_P (inner)
22033d
 	       || TRULY_NOOP_TRUNCATION_MODES_P (tmode, inner_mode)
22033d
--- /dev/null
22033d
+++ gcc/testsuite/gcc.c-torture/execute/pr78378.c
22033d
@@ -0,0 +1,18 @@
22033d
+/* PR rtl-optimization/78378 */
22033d
+
22033d
+unsigned long long __attribute__ ((noinline, noclone))
22033d
+foo (unsigned long long x)
22033d
+{
22033d
+  x <<= 41;
22033d
+  x /= 232;
22033d
+  return 1 + (unsigned short) x;
22033d
+}
22033d
+
22033d
+int
22033d
+main ()
22033d
+{
22033d
+  unsigned long long x = foo (1);
22033d
+  if (x != 0x2c24)
22033d
+    __builtin_abort();
22033d
+  return 0;
22033d
+}
22033d