Blame SOURCES/gcc48-pr78378.patch

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