]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Improve comparison rtx_cost (PR81288)
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 1 Dec 2017 20:37:33 +0000 (21:37 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Fri, 1 Dec 2017 20:37:33 +0000 (21:37 +0100)
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
gcc/config/rs6000/rs6000.c

index ed5ca67253d0c571d1801ea3a3adcd7c586fba19..a5987949442e310a57ec1b440a801f2af0b5f561 100644 (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-29  Daniel Cederman  <cederman@gaisler.com>
 
        Backport from mainline
index 07d69c4318053f00e116473f93d4cd66750e9a2b..8e041047b737080393acbc6ed6842aa50d953fa2 100644 (file)
@@ -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)
        {