Blame SOURCES/gcc48-pr78378.patch

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