public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Add debug dumping of cost table fields
@ 2015-05-01 14:31 Kyrill Tkachov
  2015-05-27  8:47 ` Kyrill Tkachov
  0 siblings, 1 reply; 7+ messages in thread
From: Kyrill Tkachov @ 2015-05-01 14:31 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

Hi all,

This patch adds a macro to wrap cost field accesses into a helpful debug dump,
saying which field is being accessed at what line and with what values.
This helped me track down cases where the costs were doing the wrong thing
by allowing me to see which path in arm_new_rtx_costs was taken.
For example, the combine log might now contain:

Trying 2 -> 6:
Successfully matched this instruction:
(set (reg:SI 115 [ D.5348 ])
     (neg:SI (reg:SI 0 r0 [ a ])))
using extra_cost->alu.arith with cost 0 from line 10506

which can be useful in debugging the rtx costs.

Bootstrapped and tested on arm.

Ok for trunk?

Thanks,
Kyrill


2015-05-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.c (DBG_COST): New macro.
     (arm_new_rtx_costs): Use above.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arm-debug-cost-fields.patch --]
[-- Type: text/x-patch; name=arm-debug-cost-fields.patch, Size: 34887 bytes --]

commit 554c118dd2c232a62e2e504f9af3bfcb417ce7c3
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Thu Apr 2 13:37:20 2015 +0100

    [ARM] Add debug dumping of cost table fields.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 4abd38a..a460d76 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -9684,6 +9684,11 @@ arm_unspec_cost (rtx x, enum rtx_code /* outer_code */, bool speed_p, int *cost)
 	  }								\
 	while (0);
 
+
+#define DBG_COST(F) ((dump_file && (dump_flags & TDF_DETAILS)      \
+  ? fprintf (dump_file, "using "#F" with cost %d from line %d\n",  \
+    (F), __LINE__) : 0), (F))
+
 /* RTX costs.  Make an estimate of the cost of executing the operation
    X, which is contained with an operation with code OUTER_CODE.
    SPEED_P indicates whether the cost desired is the performance cost,
@@ -9784,7 +9789,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		  + arm_address_cost (XEXP (x, 0), mode,
 				      ADDR_SPACE_GENERIC, speed_p));
 #else
-        *cost += extra_cost->ldst.load;
+        *cost += DBG_COST (extra_cost->ldst.load);
 #endif
       return true;
 
@@ -9812,11 +9817,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    {
 	      HOST_WIDE_INT nregs = XVECLEN (x, 0);
 	      HOST_WIDE_INT regs_per_insn_1st = is_ldm
-	                              ? extra_cost->ldst.ldm_regs_per_insn_1st
-	                              : extra_cost->ldst.stm_regs_per_insn_1st;
+		? DBG_COST (extra_cost->ldst.ldm_regs_per_insn_1st)
+		: DBG_COST (extra_cost->ldst.stm_regs_per_insn_1st);
 	      HOST_WIDE_INT regs_per_insn_sub = is_ldm
-	                       ? extra_cost->ldst.ldm_regs_per_insn_subsequent
-	                       : extra_cost->ldst.stm_regs_per_insn_subsequent;
+		? DBG_COST (extra_cost->ldst.ldm_regs_per_insn_subsequent)
+		: DBG_COST (extra_cost->ldst.stm_regs_per_insn_subsequent);
 
 	      *cost += regs_per_insn_1st
 	               + COSTS_N_INSNS (((MAX (nregs - regs_per_insn_1st, 0))
@@ -9833,9 +9838,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
       if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT
 	  && (mode == SFmode || !TARGET_VFP_SINGLE))
 	*cost += COSTS_N_INSNS (speed_p
-			       ? extra_cost->fp[mode != SFmode].div : 0);
+			? DBG_COST (extra_cost->fp[mode != SFmode].div) : 0);
       else if (mode == SImode && TARGET_IDIV)
-	*cost += COSTS_N_INSNS (speed_p ? extra_cost->mult[0].idiv : 0);
+	*cost += COSTS_N_INSNS (speed_p ? DBG_COST (extra_cost->mult[0].idiv)
+					 : 0);
       else
 	*cost = LIBCALL_COST (2);
       return false;	/* All arguments must be in registers.  */
@@ -9851,7 +9857,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += (COSTS_N_INSNS (1)
 		   + rtx_cost (XEXP (x, 0), code, 0, speed_p));
 	  if (speed_p)
-	    *cost += extra_cost->alu.shift_reg;
+	    *cost += DBG_COST (extra_cost->alu.shift_reg);
 	  return true;
 	}
       /* Fall through */
@@ -9864,7 +9870,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += (COSTS_N_INSNS (2)
 		   + rtx_cost (XEXP (x, 0), code, 0, speed_p));
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.shift;
+	    *cost += DBG_COST (2 * extra_cost->alu.shift);
 	  return true;
 	}
       else if (mode == SImode)
@@ -9872,7 +9878,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  /* Slightly disparage register shifts at -Os, but not by much.  */
 	  if (!CONST_INT_P (XEXP (x, 1)))
-	    *cost += (speed_p ? extra_cost->alu.shift_reg : 1
+	    *cost += (speed_p ? DBG_COST (extra_cost->alu.shift_reg) : 1
 		      + rtx_cost (XEXP (x, 1), code, 1, speed_p));
 	  return true;
 	}
@@ -9885,7 +9891,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      /* Slightly disparage register shifts at -Os, but not by
 	         much.  */
 	      if (!CONST_INT_P (XEXP (x, 1)))
-		*cost += (speed_p ? extra_cost->alu.shift_reg : 1
+		*cost += (speed_p ? DBG_COST (extra_cost->alu.shift_reg) : 1
 			  + rtx_cost (XEXP (x, 1), code, 1, speed_p));
 	    }
 	  else if (code == LSHIFTRT || code == ASHIFTRT)
@@ -9894,7 +9900,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		{
 		  /* Can use SBFX/UBFX.  */
 		  if (speed_p)
-		    *cost += extra_cost->alu.bfx;
+		    *cost += DBG_COST (extra_cost->alu.bfx);
 		  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 		}
 	      else
@@ -9904,10 +9910,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		  if (speed_p)
 		    {
 		      if (CONST_INT_P (XEXP (x, 1)))
-			*cost += 2 * extra_cost->alu.shift;
+			*cost += 2 * DBG_COST (extra_cost->alu.shift);
 		      else
-			*cost += (extra_cost->alu.shift
-				  + extra_cost->alu.shift_reg);
+			*cost += (DBG_COST (extra_cost->alu.shift)
+				  + DBG_COST (extra_cost->alu.shift_reg));
 		    }
 		  else
 		    /* Slightly disparage register shifts.  */
@@ -9921,12 +9927,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      if (speed_p)
 		{
 		  if (CONST_INT_P (XEXP (x, 1)))
-		    *cost += (2 * extra_cost->alu.shift
-			      + extra_cost->alu.log_shift);
+		    *cost += (DBG_COST (2 * extra_cost->alu.shift)
+			      + DBG_COST (extra_cost->alu.log_shift));
 		  else
-		    *cost += (extra_cost->alu.shift
-			      + extra_cost->alu.shift_reg
-			      + extra_cost->alu.log_shift_reg);
+		    *cost += (DBG_COST (extra_cost->alu.shift)
+			      + DBG_COST (extra_cost->alu.shift_reg)
+			      + DBG_COST (extra_cost->alu.log_shift_reg));
 		}
 	    }
 	  return true;
@@ -9941,7 +9947,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
           if (mode == SImode)
             {
               if (speed_p)
-                *cost += extra_cost->alu.rev;
+                *cost += DBG_COST (extra_cost->alu.rev);
 
               return false;
             }
@@ -9956,8 +9962,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 
               if (speed_p)
                 {
-                  *cost += 6 * extra_cost->alu.shift;
-                  *cost += 3 * extra_cost->alu.logical;
+                  *cost += DBG_COST (6 * extra_cost->alu.shift);
+                  *cost += DBG_COST (3 * extra_cost->alu.logical);
                 }
             }
           else
@@ -9966,9 +9972,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 
               if (speed_p)
                 {
-                  *cost += 2 * extra_cost->alu.shift;
-                  *cost += extra_cost->alu.arith_shift;
-                  *cost += 2 * extra_cost->alu.logical;
+                  *cost += DBG_COST (2 * extra_cost->alu.shift);
+                  *cost += DBG_COST (extra_cost->alu.arith_shift);
+                  *cost += DBG_COST (2 * extra_cost->alu.logical);
                 }
             }
           return true;
@@ -9985,7 +9991,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      rtx mul_op0, mul_op1, sub_op;
 
 	      if (speed_p)
-		*cost += extra_cost->fp[mode != SFmode].mult_addsub;
+		*cost += DBG_COST (extra_cost->fp[mode != SFmode].mult_addsub);
 
 	      if (GET_CODE (XEXP (x, 0)) == MULT)
 		{
@@ -10013,7 +10019,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    }
 
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode != SFmode].addsub;
+	    *cost += DBG_COST (extra_cost->fp[mode != SFmode].addsub);
 	  return false;
 	}
 
@@ -10037,11 +10043,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      if (shift_by_reg != NULL)
 		{
 		  if (speed_p)
-		    *cost += extra_cost->alu.arith_shift_reg;
+		    *cost += DBG_COST (extra_cost->alu.arith_shift_reg);
 		  *cost += rtx_cost (shift_by_reg, code, 0, speed_p);
 		}
 	      else if (speed_p)
-		*cost += extra_cost->alu.arith_shift;
+		*cost += DBG_COST (extra_cost->alu.arith_shift);
 
 	      *cost += (rtx_cost (shift_op, code, 0, speed_p)
 			+ rtx_cost (non_shift_op, code, 0, speed_p));
@@ -10053,7 +10059,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    {
 	      /* MLS.  */
 	      if (speed_p)
-		*cost += extra_cost->mult[0].add;
+		*cost += DBG_COST (extra_cost->mult[0].add);
 	      *cost += (rtx_cost (XEXP (x, 0), MINUS, 0, speed_p)
 			+ rtx_cost (XEXP (XEXP (x, 1), 0), MULT, 0, speed_p)
 			+ rtx_cost (XEXP (XEXP (x, 1), 1), MULT, 1, speed_p));
@@ -10067,12 +10073,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 					    NULL_RTX, 1, 0);
 	      *cost = COSTS_N_INSNS (insns);
 	      if (speed_p)
-		*cost += insns * extra_cost->alu.arith;
+		*cost += insns * DBG_COST (extra_cost->alu.arith);
 	      *cost += rtx_cost (XEXP (x, 1), code, 1, speed_p);
 	      return true;
 	    }
 	  else if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 
 	  return false;
 	}
@@ -10092,7 +10098,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  /* Slightly disparage, as we might need to widen the result.  */
 	  *cost += 1;
 	  if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 
 	  if (CONST_INT_P (XEXP (x, 0)))
 	    {
@@ -10112,7 +10118,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      rtx op1 = XEXP (x, 1);
 
 	      if (speed_p)
-		*cost += 2 * extra_cost->alu.arith;
+		*cost += DBG_COST (2 * extra_cost->alu.arith);
 
 	      if (GET_CODE (op1) == ZERO_EXTEND)
 		*cost += rtx_cost (XEXP (op1, 0), ZERO_EXTEND, 0, speed_p);
@@ -10125,7 +10131,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  else if (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND)
 	    {
 	      if (speed_p)
-		*cost += extra_cost->alu.arith + extra_cost->alu.arith_shift;
+		*cost += DBG_COST (extra_cost->alu.arith
+				    + extra_cost->alu.arith_shift);
 	      *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), SIGN_EXTEND,
 				  0, speed_p)
 			+ rtx_cost (XEXP (x, 1), MINUS, 1, speed_p));
@@ -10135,10 +10142,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		   || GET_CODE (XEXP (x, 1)) == SIGN_EXTEND)
 	    {
 	      if (speed_p)
-		*cost += (extra_cost->alu.arith
+		*cost += (DBG_COST (extra_cost->alu.arith)
 			  + (GET_CODE (XEXP (x, 1)) == ZERO_EXTEND
-			     ? extra_cost->alu.arith
-			     : extra_cost->alu.arith_shift));
+			     ? DBG_COST (extra_cost->alu.arith)
+			     : DBG_COST (extra_cost->alu.arith_shift)));
 	      *cost += (rtx_cost (XEXP (x, 0), MINUS, 0, speed_p)
 			+ rtx_cost (XEXP (XEXP (x, 1), 0),
 				    GET_CODE (XEXP (x, 1)), 0, speed_p));
@@ -10146,7 +10153,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    }
 
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.arith;
+	    *cost += DBG_COST (2 * extra_cost->alu.arith);
 	  return false;
 	}
 
@@ -10164,7 +10171,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      rtx mul_op0, mul_op1, add_op;
 
 	      if (speed_p)
-		*cost += extra_cost->fp[mode != SFmode].mult_addsub;
+		*cost += DBG_COST (extra_cost->fp[mode != SFmode].mult_addsub);
 
 	      mul_op0 = XEXP (XEXP (x, 0), 0);
 	      mul_op1 = XEXP (XEXP (x, 0), 1);
@@ -10178,7 +10185,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    }
 
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode != SFmode].addsub;
+	    *cost += DBG_COST (extra_cost->fp[mode != SFmode].addsub);
 	  return false;
 	}
       else if (GET_MODE_CLASS (mode) == MODE_FLOAT)
@@ -10206,7 +10213,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 					    NULL_RTX, 1, 0);
 	      *cost = COSTS_N_INSNS (insns);
 	      if (speed_p)
-		*cost += insns * extra_cost->alu.arith;
+		*cost += insns * DBG_COST (extra_cost->alu.arith);
 	      /* Slightly penalize a narrow operation as the result may
 		 need widening.  */
 	      *cost += 1 + rtx_cost (XEXP (x, 0), PLUS, 0, speed_p);
@@ -10217,7 +10224,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	     need widening.  */
 	  *cost += 1;
 	  if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 
 	  return false;
 	}
@@ -10232,7 +10239,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    {
 	      /* UXTA[BH] or SXTA[BH].  */
 	      if (speed_p)
-		*cost += extra_cost->alu.extend_arith;
+		*cost += DBG_COST (extra_cost->alu.extend_arith);
 	      *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), ZERO_EXTEND, 0,
 				  speed_p)
 			+ rtx_cost (XEXP (x, 1), PLUS, 0, speed_p));
@@ -10246,11 +10253,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      if (shift_reg)
 		{
 		  if (speed_p)
-		    *cost += extra_cost->alu.arith_shift_reg;
+		    *cost += DBG_COST (extra_cost->alu.arith_shift_reg);
 		  *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
 		}
 	      else if (speed_p)
-		*cost += extra_cost->alu.arith_shift;
+		*cost += DBG_COST (extra_cost->alu.arith_shift);
 
 	      *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
 			+ rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
@@ -10277,7 +10284,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		{
 		  /* SMLA[BT][BT].  */
 		  if (speed_p)
-		    *cost += extra_cost->mult[0].extend_add;
+		    *cost += DBG_COST (extra_cost->mult[0].extend_add);
 		  *cost += (rtx_cost (XEXP (XEXP (mul_op, 0), 0),
 				      SIGN_EXTEND, 0, speed_p)
 			    + rtx_cost (XEXP (XEXP (mul_op, 1), 0),
@@ -10300,12 +10307,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 					    NULL_RTX, 1, 0);
 	      *cost = COSTS_N_INSNS (insns);
 	      if (speed_p)
-		*cost += insns * extra_cost->alu.arith;
+		*cost += insns * DBG_COST (extra_cost->alu.arith);
 	      *cost += rtx_cost (XEXP (x, 0), PLUS, 0, speed_p);
 	      return true;
 	    }
 	  else if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 
 	  return false;
 	}
@@ -10320,7 +10327,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		      && GET_CODE (XEXP (XEXP (x, 0), 1)) == SIGN_EXTEND)))
 	    {
 	      if (speed_p)
-		*cost += extra_cost->mult[1].extend_add;
+		*cost += DBG_COST (extra_cost->mult[1].extend_add);
 	      *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0),
 				  ZERO_EXTEND, 0, speed_p)
 			+ rtx_cost (XEXP (XEXP (XEXP (x, 0), 1), 0),
@@ -10335,10 +10342,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      || GET_CODE (XEXP (x, 0)) == SIGN_EXTEND)
 	    {
 	      if (speed_p)
-		*cost += (extra_cost->alu.arith
+		*cost += (DBG_COST (extra_cost->alu.arith)
 			  + (GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
-			     ? extra_cost->alu.arith
-			     : extra_cost->alu.arith_shift));
+			     ? DBG_COST (extra_cost->alu.arith)
+			     : DBG_COST (extra_cost->alu.arith_shift)));
 
 	      *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), ZERO_EXTEND, 0,
 				  speed_p)
@@ -10347,7 +10354,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    }
 
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.arith;
+	    *cost += DBG_COST (2 * extra_cost->alu.arith);
 	  return false;
 	}
 
@@ -10362,7 +10369,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
             *cost += rtx_cost (inner, BSWAP, 0 , speed_p);
 
             if (speed_p)
-              *cost += extra_cost->alu.rev;
+              *cost += DBG_COST (extra_cost->alu.rev);
 
             return true;
           }
@@ -10387,11 +10394,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      if (shift_reg)
 		{
 		  if (speed_p)
-		    *cost += extra_cost->alu.log_shift_reg;
+		    *cost += DBG_COST (extra_cost->alu.log_shift_reg);
 		  *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
 		}
 	      else if (speed_p)
-		*cost += extra_cost->alu.log_shift;
+		*cost += DBG_COST (extra_cost->alu.log_shift);
 
 	      *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
 			+ rtx_cost (XEXP (x, 1), code, 1, speed_p));
@@ -10406,13 +10413,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 
 	      *cost = COSTS_N_INSNS (insns);
 	      if (speed_p)
-		*cost += insns * extra_cost->alu.logical;
+		*cost += insns * DBG_COST (extra_cost->alu.logical);
 	      *cost += rtx_cost (op0, code, 0, speed_p);
 	      return true;
 	    }
 
 	  if (speed_p)
-	    *cost += extra_cost->alu.logical;
+	    *cost += DBG_COST (extra_cost->alu.logical);
 	  *cost += (rtx_cost (op0, code, 0, speed_p)
 		    + rtx_cost (XEXP (x, 1), code, 1, speed_p));
 	  return true;
@@ -10433,7 +10440,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  if (GET_CODE (op0) == ZERO_EXTEND)
 	    {
 	      if (speed_p)
-		*cost += 2 * extra_cost->alu.logical;
+		*cost += DBG_COST (2 * extra_cost->alu.logical);
 
 	      *cost += (rtx_cost (XEXP (op0, 0), ZERO_EXTEND, 0, speed_p)
 			+ rtx_cost (XEXP (x, 1), code, 0, speed_p));
@@ -10442,7 +10449,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  else if (GET_CODE (op0) == SIGN_EXTEND)
 	    {
 	      if (speed_p)
-		*cost += extra_cost->alu.logical + extra_cost->alu.log_shift;
+		*cost += DBG_COST (extra_cost->alu.logical + extra_cost->alu.log_shift);
 
 	      *cost += (rtx_cost (XEXP (op0, 0), SIGN_EXTEND, 0, speed_p)
 			+ rtx_cost (XEXP (x, 1), code, 0, speed_p));
@@ -10450,7 +10457,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    }
 
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.logical;
+	    *cost += DBG_COST (2 * extra_cost->alu.logical);
 
 	  return true;
 	}
@@ -10469,7 +10476,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    op0 = XEXP (op0, 0);
 
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode != SFmode].mult;
+	    *cost += DBG_COST (extra_cost->fp[mode != SFmode].mult);
 
 	  *cost += (rtx_cost (op0, MULT, 0, speed_p)
 		    + rtx_cost (XEXP (x, 1), MULT, 1, speed_p));
@@ -10500,13 +10507,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    {
 	      /* SMUL[TB][TB].  */
 	      if (speed_p)
-		*cost += extra_cost->mult[0].extend;
+		*cost += DBG_COST (extra_cost->mult[0].extend);
 	      *cost += (rtx_cost (XEXP (x, 0), SIGN_EXTEND, 0, speed_p)
 			+ rtx_cost (XEXP (x, 1), SIGN_EXTEND, 0, speed_p));
 	      return true;
 	    }
 	  if (speed_p)
-	    *cost += extra_cost->mult[0].simple;
+	    *cost += DBG_COST (extra_cost->mult[0].simple);
 	  return false;
 	}
 
@@ -10519,7 +10526,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		      && GET_CODE (XEXP (x, 1)) == SIGN_EXTEND)))
 	    {
 	      if (speed_p)
-		*cost += extra_cost->mult[1].extend;
+		*cost += DBG_COST (extra_cost->mult[1].extend);
 	      *cost += (rtx_cost (XEXP (XEXP (x, 0), 0),
 				  ZERO_EXTEND, 0, speed_p)
 			+ rtx_cost (XEXP (XEXP (x, 1), 0),
@@ -10540,7 +10547,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  && (mode == SFmode || !TARGET_VFP_SINGLE))
 	{
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode != SFmode].neg;
+	    *cost += DBG_COST (extra_cost->fp[mode != SFmode].neg);
 
 	  return false;
 	}
@@ -10557,8 +10564,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      *cost += COSTS_N_INSNS (1);
 	      /* Assume the non-flag-changing variant.  */
 	      if (speed_p)
-		*cost += (extra_cost->alu.log_shift
-			  + extra_cost->alu.arith_shift);
+		*cost += (DBG_COST (extra_cost->alu.log_shift)
+			  + DBG_COST (extra_cost->alu.arith_shift));
 	      *cost += rtx_cost (XEXP (XEXP (x, 0), 0), ABS, 0, speed_p);
 	      return true;
 	    }
@@ -10580,13 +10587,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 			    + rtx_cost (XEXP (XEXP (x, 0), 1), COMPARE, 1,
 					speed_p));
 		  if (speed_p)
-		    *cost += extra_cost->alu.arith;
+		    *cost += DBG_COST (extra_cost->alu.arith);
 		}
 	      return true;
 	    }
 
 	  if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 	  return false;
 	}
 
@@ -10596,7 +10603,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  /* Slightly disparage, as we might need an extend operation.  */
 	  *cost += 1;
 	  if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 	  return false;
 	}
 
@@ -10604,7 +10611,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	{
 	  *cost += COSTS_N_INSNS (1);
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.arith;
+	    *cost += 2 * DBG_COST (extra_cost->alu.arith);
 	  return false;
 	}
 
@@ -10625,17 +10632,17 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      if (shift_reg != NULL)
 		{
 		  if (speed_p)
-		    *cost += extra_cost->alu.log_shift_reg;
+		    *cost += DBG_COST (extra_cost->alu.log_shift_reg);
 		  *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
 		}
 	      else if (speed_p)
-		*cost += extra_cost->alu.log_shift;
+		*cost += DBG_COST (extra_cost->alu.log_shift);
 	      *cost += rtx_cost (shift_op, ASHIFT, 0, speed_p);
 	      return true;
 	    }
 
 	  if (speed_p)
-	    *cost += extra_cost->alu.logical;
+	    *cost += DBG_COST (extra_cost->alu.logical);
 	  return false;
 	}
       if (mode == DImode)
@@ -10672,9 +10679,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    if (speed_p)
 	      {
 		if (extra_cost->alu.non_exec_costs_exec)
-		  *cost += op1cost + op2cost + extra_cost->alu.non_exec;
+		  *cost += op1cost + op2cost + DBG_COST (extra_cost->alu.non_exec);
 		else
-		  *cost += MAX (op1cost, op2cost) + extra_cost->alu.non_exec;
+		  *cost += MAX (op1cost, op2cost) + DBG_COST (extra_cost->alu.non_exec);
 	      }
 	    else
 	      *cost += op1cost + op2cost;
@@ -10697,7 +10704,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	      && (op0mode == SFmode || !TARGET_VFP_SINGLE))
 	    {
 	      if (speed_p)
-		*cost += extra_cost->fp[op0mode != SFmode].compare;
+		*cost += DBG_COST (extra_cost->fp[op0mode != SFmode].compare);
 
 	      if (XEXP (x, 1) == CONST0_RTX (op0mode))
 		{
@@ -10718,7 +10725,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    {
 	      *cost += COSTS_N_INSNS (1);
 	      if (speed_p)
-		*cost += 2 * extra_cost->alu.arith;
+		*cost += DBG_COST (2 * extra_cost->alu.arith);
 	      return false;
 	    }
 
@@ -10739,14 +10746,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		  if (speed_p
 		      && GET_CODE (XEXP (x, 0)) == MULT
 		      && !power_of_two_operand (XEXP (XEXP (x, 0), 1), mode))
-		    *cost += extra_cost->mult[0].flag_setting;
+		    *cost += DBG_COST (extra_cost->mult[0].flag_setting);
 
 		  if (speed_p
 		      && GET_CODE (XEXP (x, 0)) == PLUS
 		      && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
 		      && !power_of_two_operand (XEXP (XEXP (XEXP (x, 0),
 							    0), 1), mode))
-		    *cost += extra_cost->mult[0].flag_setting;
+		    *cost += DBG_COST (extra_cost->mult[0].flag_setting);
 		  return true;
 		}
 
@@ -10758,17 +10765,17 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		    {
 		      *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
 		      if (speed_p)
-			*cost += extra_cost->alu.arith_shift_reg;
+			*cost += DBG_COST (extra_cost->alu.arith_shift_reg);
 		    }
 		  else if (speed_p)
-		    *cost += extra_cost->alu.arith_shift;
+		    *cost += DBG_COST (extra_cost->alu.arith_shift);
 		  *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
 			    + rtx_cost (XEXP (x, 1), COMPARE, 1, speed_p));
 		  return true;
 		}
 
 	      if (speed_p)
-		*cost += extra_cost->alu.arith;
+		*cost += DBG_COST (extra_cost->alu.arith);
 	      if (CONST_INT_P (XEXP (x, 1))
 		  && const_ok_for_op (INTVAL (XEXP (x, 1)), COMPARE))
 		{
@@ -10820,7 +10827,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		case LT:
 		  /* LSR Rd, Rn, #31.  */
 		  if (speed_p)
-		    *cost += extra_cost->alu.shift;
+		    *cost += DBG_COST (extra_cost->alu.shift);
 		  break;
 
 		case EQ:
@@ -10838,7 +10845,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		     ADC  Rd, Rn, T1. */
 		  *cost += COSTS_N_INSNS (1);
 		  if (speed_p)
-		    *cost += extra_cost->alu.arith_shift;
+		    *cost += DBG_COST (extra_cost->alu.arith_shift);
 		  break;
 
 		case GT:
@@ -10846,8 +10853,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		     LSR  Rd, Rd, #31.  */
 		  *cost += COSTS_N_INSNS (1);
 		  if (speed_p)
-		    *cost += (extra_cost->alu.arith_shift
-			      + extra_cost->alu.shift);
+		    *cost += (DBG_COST (extra_cost->alu.arith_shift)
+			      + DBG_COST (extra_cost->alu.shift));
 		  break;
 
 		case GE:
@@ -10855,7 +10862,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		     ADD  Rd, Rn, #1.  */
 		  *cost += COSTS_N_INSNS (1);
 		  if (speed_p)
-		    *cost += extra_cost->alu.shift;
+		    *cost += DBG_COST (extra_cost->alu.shift);
 		  break;
 
 		default:
@@ -10898,7 +10905,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  && (mode == SFmode || !TARGET_VFP_SINGLE))
 	{
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode != SFmode].neg;
+	    *cost += DBG_COST (extra_cost->fp[mode != SFmode].neg);
 
 	  return false;
 	}
@@ -10911,7 +10918,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
       if (mode == SImode)
 	{
 	  if (speed_p)
-	    *cost += extra_cost->alu.log_shift + extra_cost->alu.arith_shift;
+	    *cost += DBG_COST (extra_cost->alu.log_shift + extra_cost->alu.arith_shift);
 	  return false;
 	}
       /* Vector mode?  */
@@ -10931,12 +10938,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	    return true;
 
 	  if (GET_MODE (XEXP (x, 0)) == SImode)
-	    *cost += extra_cost->ldst.load;
+	    *cost += DBG_COST (extra_cost->ldst.load);
 	  else
-	    *cost += extra_cost->ldst.load_sign_extend;
+	    *cost += DBG_COST (extra_cost->ldst.load_sign_extend);
 
 	  if (mode == DImode)
-	    *cost += extra_cost->alu.shift;
+	    *cost += DBG_COST (extra_cost->alu.shift);
 
 	  return true;
 	}
@@ -10947,7 +10954,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  /* We have SXTB/SXTH.  */
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  if (speed_p)
-	    *cost += extra_cost->alu.extend;
+	    *cost += DBG_COST (extra_cost->alu.extend);
 	}
       else if (GET_MODE (XEXP (x, 0)) != SImode)
 	{
@@ -10955,7 +10962,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += COSTS_N_INSNS (1);
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.shift;
+	    *cost += DBG_COST (2 * extra_cost->alu.shift);
 	}
 
       /* Widening beyond 32-bits requires one more insn.  */
@@ -10963,7 +10970,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	{
 	  *cost += COSTS_N_INSNS (1);
 	  if (speed_p)
-	    *cost += extra_cost->alu.shift;
+	    *cost += DBG_COST (extra_cost->alu.shift);
 	}
 
       return true;
@@ -10991,14 +10998,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	     AND, and we don't really model 16-bit vs 32-bit insns
 	     here.  */
 	  if (speed_p)
-	    *cost += extra_cost->alu.logical;
+	    *cost += DBG_COST (extra_cost->alu.logical);
 	}
       else if (GET_MODE (XEXP (x, 0)) != SImode && arm_arch6)
 	{
 	  /* We have UXTB/UXTH.  */
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  if (speed_p)
-	    *cost += extra_cost->alu.extend;
+	    *cost += DBG_COST (extra_cost->alu.extend);
 	}
       else if (GET_MODE (XEXP (x, 0)) != SImode)
 	{
@@ -11009,7 +11016,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += COSTS_N_INSNS (1);
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  if (speed_p)
-	    *cost += 2 * extra_cost->alu.shift;
+	    *cost += DBG_COST (2 * extra_cost->alu.shift);
 	}
 
       /* Widening beyond 32-bits requires one more insn.  */
@@ -11070,7 +11077,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  if (arm_arch_thumb2 && !flag_pic)
 	    *cost += COSTS_N_INSNS (1);
 	  else
-	    *cost += extra_cost->ldst.load;
+	    *cost += DBG_COST (extra_cost->ldst.load);
 	}
       else
 	*cost += COSTS_N_INSNS (1);
@@ -11079,7 +11086,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	{
 	  *cost += COSTS_N_INSNS (1);
 	  if (speed_p)
-	    *cost += extra_cost->alu.arith;
+	    *cost += DBG_COST (extra_cost->alu.arith);
 	}
 
       return true;
@@ -11096,16 +11103,16 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  if (vfp3_const_double_rtx (x))
 	    {
 	      if (speed_p)
-		*cost += extra_cost->fp[mode == DFmode].fpconst;
+		*cost += DBG_COST (extra_cost->fp[mode == DFmode].fpconst);
 	      return true;
 	    }
 
 	  if (speed_p)
 	    {
 	      if (mode == DFmode)
-		*cost += extra_cost->ldst.loadd;
+		*cost += DBG_COST (extra_cost->ldst.loadd);
 	      else
-		*cost += extra_cost->ldst.loadf;
+		*cost += DBG_COST (extra_cost->ldst.loadf);
 	    }
 	  else
 	    *cost += COSTS_N_INSNS (1 + (mode == DFmode));
@@ -11136,14 +11143,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 
     case CLZ:
       if (speed_p)
-	*cost += extra_cost->alu.clz;
+	*cost += DBG_COST (extra_cost->alu.clz);
       return false;
 
     case SMIN:
       if (XEXP (x, 1) == const0_rtx)
 	{
 	  if (speed_p)
-	    *cost += extra_cost->alu.log_shift;
+	    *cost += DBG_COST (extra_cost->alu.log_shift);
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  return true;
 	}
@@ -11166,7 +11173,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		      == ZERO_EXTEND))))
 	{
 	  if (speed_p)
-	    *cost += extra_cost->mult[1].extend;
+	    *cost += DBG_COST (extra_cost->mult[1].extend);
 	  *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), ZERO_EXTEND, 0,
 			      speed_p)
 		    + rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 1), ZERO_EXTEND,
@@ -11195,14 +11202,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  && CONST_INT_P (XEXP (x, 2)))
 	{
 	  if (speed_p)
-	    *cost += extra_cost->alu.bfx;
+	    *cost += DBG_COST (extra_cost->alu.bfx);
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  return true;
 	}
       /* Without UBFX/SBFX, need to resort to shift operations.  */
       *cost += COSTS_N_INSNS (1);
       if (speed_p)
-	*cost += 2 * extra_cost->alu.shift;
+	*cost += DBG_COST (2 * extra_cost->alu.shift);
       *cost += rtx_cost (XEXP (x, 0), ASHIFT, 0, speed_p);
       return true;
 
@@ -11210,7 +11217,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
       if (TARGET_HARD_FLOAT)
 	{
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode == DFmode].widen;
+	    *cost += DBG_COST (extra_cost->fp[mode == DFmode].widen);
 	  if (!TARGET_FPU_ARMV8
 	      && GET_MODE (XEXP (x, 0)) == HFmode)
 	    {
@@ -11218,7 +11225,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	         widening to SFmode.  */
 	      *cost += COSTS_N_INSNS (1);
 	      if (speed_p)
-		*cost += extra_cost->fp[0].widen;
+		*cost += DBG_COST (extra_cost->fp[0].widen);
 	    }
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  return true;
@@ -11231,7 +11238,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
       if (TARGET_HARD_FLOAT)
 	{
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode == DFmode].narrow;
+	    *cost += DBG_COST (extra_cost->fp[mode == DFmode].narrow);
 	  *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
 	  return true;
 	  /* Vector modes?  */
@@ -11260,7 +11267,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
           *cost += rtx_cost (op2, FMA, 2, speed_p);
 
           if (speed_p)
-            *cost += extra_cost->fp[mode ==DFmode].fma;
+            *cost += DBG_COST (extra_cost->fp[mode ==DFmode].fma);
 
           return true;
         }
@@ -11275,7 +11282,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  if (GET_MODE_CLASS (mode) == MODE_INT)
 	    {
 	      if (speed_p)
-		*cost += extra_cost->fp[GET_MODE (XEXP (x, 0)) == DFmode].toint;
+		*cost += DBG_COST (extra_cost->fp[GET_MODE (XEXP (x, 0)) == DFmode].toint);
 	      /* Strip of the 'cost' of rounding towards zero.  */
 	      if (GET_CODE (XEXP (x, 0)) == FIX)
 		*cost += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, speed_p);
@@ -11289,7 +11296,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 		   && TARGET_FPU_ARMV8)
 	    {
 	      if (speed_p)
-		*cost += extra_cost->fp[mode == DFmode].roundint;
+		*cost += DBG_COST (extra_cost->fp[mode == DFmode].roundint);
 	      return false;
 	    }
 	  /* Vector costs? */
@@ -11304,7 +11311,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  /* ??? Increase the cost to deal with transferring from CORE
 	     -> FP registers?  */
 	  if (speed_p)
-	    *cost += extra_cost->fp[mode == DFmode].fromint;
+	    *cost += DBG_COST (extra_cost->fp[mode == DFmode].fromint);
 	  return false;
 	}
       *cost = LIBCALL_COST (1);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-08  8:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-01 14:31 [PATCH][ARM] Add debug dumping of cost table fields Kyrill Tkachov
2015-05-27  8:47 ` Kyrill Tkachov
2015-05-27  9:04   ` Andrew Pinski
2015-05-27  9:29     ` Bin.Cheng
2015-05-27 10:25       ` Kyrill Tkachov
2015-06-16  8:41     ` Kyrill Tkachov
2015-07-08  8:22       ` Kyrill Tkachov

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).