This is the mail archive of the
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: 20 Mar 2004 19:01:47 -0500
- Subject: Re: Bad choices by expand_mult_highpart
- References: <200403202340.AAA11195@faui1d.informatik.uni-erlangen.de>
Ulrich Weigand <email@example.com> writes:
> 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);
> return 0;
> now returns
> 95 -3702
> instead of
> 33 18
> 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 ...
> Any idea?
> Dr. Ulrich Weigand
Have you filed a bug against this yet? This looks really similar to what
is causing my bootstrap failure on sparc-linux.