re PR target/92905 (Spills float-int union to memory)
authorVladimir Makarov <vmakarov@redhat.com>
Thu, 19 Dec 2019 21:59:47 +0000 (21:59 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Thu, 19 Dec 2019 21:59:47 +0000 (21:59 +0000)
2019-12-19  Vladimir Makarov  <vmakarov@redhat.com>

PR target/92905
* lra-constraints.c (process_alt_operands): Check offmemok when
processing preferred_reload_class.

2019-12-19  Vladimir Makarov  <vmakarov@redhat.com>

PR target/92905
* gcc.target/i386/pr92905.c: New test.

From-SVN: r279596

gcc/ChangeLog
gcc/lra-constraints.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr92905.c [new file with mode: 0644]

index 361697e5407a6bebcb6ba45157530558984fd603..1d78e020b198e2fb4a88a7d81f72c40d79a3a132 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-19  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR target/92905
+       * lra-constraints.c (process_alt_operands): Check offmemok when
+       processing preferred_reload_class.
+
 2019-12-19  Andrew Stubbs  <ams@codesourcery.com>
 
        * config/gcn/gcn-valu.md
index 9e0f50ea88c413fc7f51dc1160ce62408dbff3fa..a5b4eefa60ea1cd3cd77581594410c934f80fd3b 100644 (file)
@@ -2722,11 +2722,24 @@ process_alt_operands (int only_alternative)
                          && (targetm.preferred_output_reload_class
                              (op, this_alternative) == NO_REGS))))
                {
-                 if (lra_dump_file != NULL)
-                   fprintf (lra_dump_file,
-                            "            %d Non-prefered reload: reject+=%d\n",
-                            nop, LRA_MAX_REJECT);
-                 reject += LRA_MAX_REJECT;
+                 if (offmemok && REG_P (op))
+                   {
+                     if (lra_dump_file != NULL)
+                       fprintf
+                         (lra_dump_file,
+                          "            %d Spill pseudo into memory: reject+=3\n",
+                          nop);
+                     reject += 3;
+                   }
+                 else
+                   {
+                     if (lra_dump_file != NULL)
+                       fprintf
+                         (lra_dump_file,
+                          "            %d Non-prefered reload: reject+=%d\n",
+                          nop, LRA_MAX_REJECT);
+                     reject += LRA_MAX_REJECT;
+                   }
                }
 
              if (! (MEM_P (op) && offmemok)
index 903e904e043244167eebdfadbd9c7a3f1bc0ae1f..5dfb3ec4ec2c569188ca833953f4bd9cabbdb570 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-19  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR target/92905
+       * gcc.target/i386/pr92905.c: New test.
+
 2019-12-19  Richard Sandiford  <richard.sandiford@arm.com>
 
        * g++.dg/ext/sve-sizeless-2.C: Don't expect an error for
diff --git a/gcc/testsuite/gcc.target/i386/pr92905.c b/gcc/testsuite/gcc.target/i386/pr92905.c
new file mode 100644 (file)
index 0000000..672ba8e
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mtune=intel" } */
+float f(float x)
+{
+    union {float f; unsigned i;} u = {x};
+    u.i |= 0x80000000;
+    return u.f;
+}
+/* { dg-final { scan-assembler-not "rsp"} } */