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: Bad choices by expand_mult_highpart


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


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