This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] arm.c: Adjust arm_size_rtx_costs to help synth_mult.
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, nickc at redhat dot com, paul at codesourcery dot com
- Date: Wed, 22 Apr 2009 09:56:32 +0100
- Subject: Re: [patch] arm.c: Adjust arm_size_rtx_costs to help synth_mult.
- References: <20090422060927.11FC66F62057@daisy.codesourcery.com>
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.