Blame SOURCES/gcc48-pr70549.patch

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