This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] arm.c: Adjust arm_size_rtx_costs to help synth_mult.


On Tue, 2009-04-21 at 23:09 -0700, Kazu Hirata wrote:
> 2009-04-22  Kazu Hirata  <kazu@codesourcery.com>
> 
> 	* config/arm/arm.c (arm_size_rtx_costs): Treat a PLUS with a shift
> 	the same as a PLUS without a shift.  Increase the cost of a
> 	CONST_INT in MULT.
> 

This is OK, but...

> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c	(revision 146323)
> +++ gcc/config/arm/arm.c	(working copy)
> @@ -5681,6 +5681,18 @@ arm_size_rtx_costs (rtx x, enum rtx_code
>  	  return false;
>  	}
>  
> +      /* A shift as a part of ADD costs nothing.  */
> +      if (GET_CODE (XEXP (x, 0)) == MULT
> +	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
> +	  && ((INTVAL (XEXP (XEXP (x, 0), 1))
> +	       & (INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))

It would be cleaner to use 
'power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode)' in this test.

R.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]