Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-07-08 Thread Kyrill Tkachov

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01064.html

Thanks,
Kyrill

On 16/06/15 09:36, Kyrill Tkachov wrote:

On 27/05/15 09:39, Andrew Pinski wrote:

On Wed, May 27, 2015 at 4:38 PM, Kyrill Tkachov kyrylo.tkac...@arm.com wrote:

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

This and the one in AARCH64 is too noisy.  Can we have an option to
turn this on and default to turning them off.

How about this? The new undocumented option can be used to turn on verbose 
costs dumping.
It is off by default.

Tested arm-none-eabi.

Ok for trunk?

Thanks,
Kyrill

2015-06-16  Kyrylo Tkachov  kyrylo.tkac...@arm.com

  * config/arm/arm.c (DBG_COST): New macro.
  (arm_new_rtx_costs): Use above.
  * config/arm/arm.opt (mdebug-rtx-costs): New option.


Thanks,
Andrew


Thanks,
Kyrill

On 01/05/15 15:31, Kyrill Tkachov wrote:

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.tkac...@arm.com

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




Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-06-16 Thread Kyrill Tkachov


On 27/05/15 09:39, Andrew Pinski wrote:

On Wed, May 27, 2015 at 4:38 PM, Kyrill Tkachov kyrylo.tkac...@arm.com wrote:

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

This and the one in AARCH64 is too noisy.  Can we have an option to
turn this on and default to turning them off.


How about this? The new undocumented option can be used to turn on verbose 
costs dumping.
It is off by default.

Tested arm-none-eabi.

Ok for trunk?

Thanks,
Kyrill

2015-06-16  Kyrylo Tkachov  kyrylo.tkac...@arm.com

* config/arm/arm.c (DBG_COST): New macro.
(arm_new_rtx_costs): Use above.
* config/arm/arm.opt (mdebug-rtx-costs): New option.


Thanks,
Andrew


Thanks,
Kyrill

On 01/05/15 15:31, Kyrill Tkachov wrote:

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.tkac...@arm.com

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




commit 9db83ab2f7763f84445763150642fe418b06b1fe
Author: Kyrylo Tkachov kyrylo.tkac...@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 737d824..cae3c02 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -9322,6 +9322,12 @@ arm_unspec_cost (rtx x, enum rtx_code /* outer_code */, bool speed_p, int *cost)
 	  }\
 	while (0);
 
+
+#define DBG_COST(F) (((debug_rtx_costs	\
+		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,
@@ -9422,7 +9428,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;
 
@@ -9450,11 +9456,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))
@@ -9471,9 +9477,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.  */
@@ -9489,7 +9496,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 */
@@ -9502,7 +9509,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)
@@ -9510,7 +9517,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 	  *cost += 

Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-05-27 Thread Bin.Cheng
On Wed, May 27, 2015 at 4:39 PM, Andrew Pinski pins...@gmail.com wrote:
 On Wed, May 27, 2015 at 4:38 PM, Kyrill Tkachov kyrylo.tkac...@arm.com 
 wrote:
 Ping.
 https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

 This and the one in AARCH64 is too noisy.  Can we have an option to
 turn this on and default to turning them off.

Agreed.  Actually I once file a PR about this enormous dump
information in gimple dumps.

Thanks,
bin

 Thanks,
 Andrew


 Thanks,
 Kyrill

 On 01/05/15 15:31, Kyrill Tkachov wrote:

 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.tkac...@arm.com

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




Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-05-27 Thread Kyrill Tkachov


On 27/05/15 09:47, Bin.Cheng wrote:

On Wed, May 27, 2015 at 4:39 PM, Andrew Pinski pins...@gmail.com wrote:

On Wed, May 27, 2015 at 4:38 PM, Kyrill Tkachov kyrylo.tkac...@arm.com wrote:

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

This and the one in AARCH64 is too noisy.  Can we have an option to
turn this on and default to turning them off.

Agreed.  Actually I once file a PR about this enormous dump
information in gimple dumps.


Ok, I'll give it a shot and gate both this and the existing Hot/Cold stuff on 
an option.
Thanks for the feedback.

Kyrill



Thanks,
bin

Thanks,
Andrew


Thanks,
Kyrill

On 01/05/15 15:31, Kyrill Tkachov wrote:

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.tkac...@arm.com

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






Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-05-27 Thread Andrew Pinski
On Wed, May 27, 2015 at 4:38 PM, Kyrill Tkachov kyrylo.tkac...@arm.com wrote:
 Ping.
 https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

This and the one in AARCH64 is too noisy.  Can we have an option to
turn this on and default to turning them off.

Thanks,
Andrew


 Thanks,
 Kyrill

 On 01/05/15 15:31, Kyrill Tkachov wrote:

 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.tkac...@arm.com

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




Re: [PATCH][ARM] Add debug dumping of cost table fields

2015-05-27 Thread Kyrill Tkachov

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00054.html

Thanks,
Kyrill
On 01/05/15 15:31, Kyrill Tkachov wrote:

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.tkac...@arm.com

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