This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bad choices by expand_mult_highpart
- From: James Morrison <ja2morri at csclub dot uwaterloo dot ca>
- To: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- Cc: rsandifo at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: 21 Mar 2004 09:30:40 -0500
- Subject: Re: Bad choices by expand_mult_highpart
- References: <200403210226.DAA11362@faui1d.informatik.uni-erlangen.de>
Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de> writes:
> Jim Morrison wrote:
>
> > Have you filed a bug against this yet? This looks really similar to what
> > is causing my bootstrap failure on sparc-linux.
>
> No, I haven't filed a bug.
>
> However, it would appear that the problem is caused by trying to do
> a signed multiply, which synth_mult doesn't actually support. To fix
> this requires an adjustment like the one performed by
> expand_mult_highpart_adjust.
>
> Also, we need to pass WIDER_MODE instead of MODE to
> choose_mult_variant, so that the test whether negate_variant is
> allowed uses the correct mode size.
>
> This in turn made the default multiplication cost computation
> in choose_mult_variant result in too high values, so I simply
> added another argument to pass in the cost bound instead.
>
> The resulting patch is attached; it fixes my test case, but I haven't
> completed full testing yet. Could you try whether it fixes your
> bootstrap problem on sparc?
>
> Richard, do you think this is a correct solution? Does is get
> the cost calculations right for your targets?
>
> Bye,
> Ulrich
>
>
>
> ChangeLog:
>
> * expmed.c (choose_mult_variant): Pass MULT_COST as argument instead
> of using register multiplication cost.
> (expand_mult): Adapt choose_mult_variant call.
> (expand_mult_highpart): Call choose_mult_variant with WIDER_MODE
> instead of MODE; pass appropriate cost bound. Adjust result when
> performing signed multiplication by a negative constant.
>
Thanks, my bootstrap completed with this patch.
Jim