From a8a728aac26d179b9087760945574a7fb09badea Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Thu, 19 Dec 2019 21:59:47 +0000 Subject: [PATCH] re PR target/92905 (Spills float-int union to memory) 2019-12-19 Vladimir Makarov PR target/92905 * lra-constraints.c (process_alt_operands): Check offmemok when processing preferred_reload_class. 2019-12-19 Vladimir Makarov PR target/92905 * gcc.target/i386/pr92905.c: New test. From-SVN: r279596 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 23 ++++++++++++++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr92905.c | 9 +++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr92905.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 361697e5407..1d78e020b19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-12-19 Vladimir Makarov + + PR target/92905 + * lra-constraints.c (process_alt_operands): Check offmemok when + processing preferred_reload_class. + 2019-12-19 Andrew Stubbs * config/gcn/gcn-valu.md diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 9e0f50ea88c..a5b4eefa60e 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 903e904e043..5dfb3ec4ec2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-19 Vladimir Makarov + + PR target/92905 + * gcc.target/i386/pr92905.c: New test. + 2019-12-19 Richard Sandiford * 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 index 00000000000..672ba8ee48a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr92905.c @@ -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"} } */ -- 2.30.2