Blame SOURCES/gcc48-pr70549.patch

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