Blame SOURCES/gcc48-pr78378.patch

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