* [PATCH] rs6000: Improve comparison rtx_cost (PR81288)
@ 2017-11-28 6:19 Segher Boessenkool
0 siblings, 0 replies; only message in thread
From: Segher Boessenkool @ 2017-11-28 6:19 UTC (permalink / raw)
To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool
The current rs6000 rtx_cost for comparisons against 0 is very high if
TARGET_ISEL && !TARGET_MFCRF, much higher than for reg-reg comparisons,
much higher than a load of 0 and such a reg-reg-comparison. This leads
to infinite recursion in CSE (see PR81288).
This patch removes the too-high cost, also simplifying this code.
Tested on powerpc64-linux {-m32,-m64}; committing to trunk. I'll backport
this later this week.
Segher
2017-11-27 Segher Boessenkool <segher@kernel.crashing.org>
PR 81288/target
* config/rs6000/rs6000.c (rs6000_rtx_costs): Do not handle
TARGET_ISEL && !TARGET_MFCRF differently. Simplify code.
---
gcc/config/rs6000/rs6000.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c877d98..7afa4c1 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -34980,14 +34980,16 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
*total = COSTS_N_INSNS (1);
return true;
}
+ /* FALLTHRU */
+
+ case GT:
+ case LT:
+ case UNORDERED:
if (outer_code == SET)
{
if (XEXP (x, 1) == const0_rtx)
{
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
+ *total = COSTS_N_INSNS (2);
return true;
}
else
@@ -34996,19 +34998,6 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
return false;
}
}
- /* FALLTHRU */
-
- case GT:
- case LT:
- case UNORDERED:
- if (outer_code == SET && (XEXP (x, 1) == const0_rtx))
- {
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
- return true;
- }
/* CC COMPARE. */
if (outer_code == COMPARE)
{
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-28 1:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 6:19 [PATCH] rs6000: Improve comparison rtx_cost (PR81288) Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).