rs6000: Improve comparison rtx_cost (PR81288)

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.


	PR 81288/target
	* config/rs6000/rs6000.c (rs6000_rtx_costs): Do not handle
	TARGET_ISEL && !TARGET_MFCRF differently.  Simplify code.

From-SVN: r255337
This commit is contained in:
Segher Boessenkool 2017-12-01 21:35:52 +01:00 committed by Segher Boessenkool
parent 50748fad7c
commit cd68fefbc0
2 changed files with 15 additions and 17 deletions

View File

@ -1,3 +1,12 @@
2017-12-01 Segher Boessenkool <segher@kernel.crashing.org>
Backport from mainline
2017-11-28 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.
2017-11-30 Jim Wilson <jimw@sifive.com> 2017-11-30 Jim Wilson <jimw@sifive.com>
Backport from mainline Backport from mainline

View File

@ -37307,14 +37307,16 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
*total = COSTS_N_INSNS (1); *total = COSTS_N_INSNS (1);
return true; return true;
} }
/* FALLTHRU */
case GT:
case LT:
case UNORDERED:
if (outer_code == SET) if (outer_code == SET)
{ {
if (XEXP (x, 1) == const0_rtx) if (XEXP (x, 1) == const0_rtx)
{ {
if (TARGET_ISEL && !TARGET_MFCRF) *total = COSTS_N_INSNS (2);
*total = COSTS_N_INSNS (8);
else
*total = COSTS_N_INSNS (2);
return true; return true;
} }
else else
@ -37323,19 +37325,6 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
return false; 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. */ /* CC COMPARE. */
if (outer_code == COMPARE) if (outer_code == COMPARE)
{ {