Blame SOURCES/gcc48-pr70549.patch

22033d
2017-03-08  Bernd Schmidt  <bschmidt@redhat.com>
22033d
22033d
	PR target/70549
22033d
	* config/aarch64/aarch64.c (aarch64_secondary_reload): Reload
22033d
	CORE_REGS rclass constants in [SD]Fmode through FP_REGS.
22033d
22033d
	* g++.dg/opt/pr70549.C: New test.
22033d
22033d
--- gcc/config/aarch64/aarch64.c.jj	2017-03-08 15:50:55.000000000 +0100
22033d
+++ gcc/config/aarch64/aarch64.c	2017-03-08 16:01:15.426080172 +0100
22033d
@@ -3846,8 +3846,13 @@ aarch64_secondary_reload (bool in_p ATTR
22033d
       && GET_MODE_SIZE (mode) == 16 && MEM_P (x))
22033d
     return FP_REGS;
22033d
 
22033d
+  if (rclass == CORE_REGS
22033d
+      && (mode == SFmode || mode == DFmode)
22033d
+      && CONSTANT_P (x))
22033d
+    return FP_REGS;
22033d
+
22033d
   if (rclass == FP_REGS && (mode == TImode || mode == TFmode) && CONSTANT_P(x))
22033d
-      return CORE_REGS;
22033d
+    return CORE_REGS;
22033d
 
22033d
   return NO_REGS;
22033d
 }
22033d
--- gcc/testsuite/g++.dg/opt/pr70549.C.jj	2017-03-08 16:02:45.104918249 +0100
22033d
+++ gcc/testsuite/g++.dg/opt/pr70549.C	2017-03-08 16:02:14.000000000 +0100
22033d
@@ -0,0 +1,33 @@
22033d
+// PR target/70549
22033d
+// { dg-do compile }
22033d
+// { dg-options "-O2" }
22033d
+// { dg-additional-options "-fPIC" { target fpic } }
22033d
+
22033d
+struct A { float x; float y; };
22033d
+A a, b, c;
22033d
+int d, e;
22033d
+A bar ();
22033d
+void foo (A, A);
22033d
+inline A operator/ (A, A p2) { if (p2.x) return a; }
22033d
+struct B { A dval; };
22033d
+int baz (A, B, A, int);
22033d
+
22033d
+void
22033d
+test ()
22033d
+{
22033d
+  B q;
22033d
+  A f, g, h, k;
22033d
+  h.x = 1.0;
22033d
+  f = h;
22033d
+  struct A i, j = f;
22033d
+  do {
22033d
+    i = bar ();
22033d
+    g = i / j;
22033d
+    foo (g, c);
22033d
+    int l = baz (k, q, b, e);
22033d
+    if (l)
22033d
+      goto cleanup;
22033d
+    j = i;
22033d
+  } while (d);
22033d
+cleanup:;
22033d
+}