From 14371acdeaf86cda16f014653d5e490de450728e Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 1 Dec 2017 21:37:33 +0100 Subject: [PATCH] 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: r255338 --- gcc/ChangeLog | 9 +++++++++ gcc/config/rs6000/rs6000.c | 23 ++++++----------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed5ca67253d0..a5987949442e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-12-01 Segher Boessenkool + + Backport from mainline + 2017-11-28 Segher Boessenkool + + PR 81288/target + * config/rs6000/rs6000.c (rs6000_rtx_costs): Do not handle + TARGET_ISEL && !TARGET_MFCRF differently. Simplify code. + 2017-11-29 Daniel Cederman Backport from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 07d69c431805..8e041047b737 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -34383,14 +34383,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 @@ -34399,19 +34401,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) { -- 2.47.2