Blame SOURCES/gcc48-pr78378.patch

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