The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92905
The patch was successfully bootstrapped on x86-64 and ppc64 and benchmarked on SPEC2000 on x86-64.
Committed as r279596
Index: ChangeLog =================================================================== --- ChangeLog (revision 279595) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2019-12-19 Vladimir Makarov <vmaka...@redhat.com> + + PR target/92905 + * lra-constraints.c (process_alt_operands): Check offmemok when + processing preferred_reload_class. + 2019-12-19 Andrew Stubbs <a...@codesourcery.com> * config/gcn/gcn-valu.md Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 279523) +++ lra-constraints.c (working copy) @@ -2722,11 +2722,24 @@ process_alt_operands (int only_alternati && (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: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 279595) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2019-12-19 Vladimir Makarov <vmaka...@redhat.com> + + PR target/92905 + * gcc.target/i386/pr92905.c: New test. + 2019-12-19 Richard Sandiford <richard.sandif...@arm.com> * g++.dg/ext/sve-sizeless-2.C: Don't expect an error for Index: testsuite/gcc.target/i386/pr92905.c =================================================================== --- testsuite/gcc.target/i386/pr92905.c (nonexistent) +++ testsuite/gcc.target/i386/pr92905.c (working copy) @@ -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"} } */