This is the mail archive of the
mailing list for the GCC project.
Re: Bad choices by expand_mult_highpart
- From: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- To: rsandifo at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Mar 2004 00:40:15 +0100 (CET)
- Subject: Re: Bad choices by expand_mult_highpart
Richard Sandiford wrote:
> * expmed.c (choose_mult_variant, expand_mult_const): New, split from...
> (expand_mult): ...here.
> (extract_high_half): New, split out from expand_mult_highpart.
> (expand_highpart_optab): Likewise. Don't clobber target prematurely.
> (expand_highpart): Evaluate the cost of a shift/add sequence,
> then see if any of the specialized optabs are cheaper.
This somehow yields incorrect arithmetic results on s390x; the test case:
long var = 1998;
int main (void)
printf ("%ld %ld\n", var / 60, var % 60);
I haven't quite understood why yet (in fact, I haven't quite understood the
whole division-by-multiplication logic in detail yet), but reverting your
patch makes the problem go away ...
Dr. Ulrich Weigand