[Bug middle-end/82004] [8 Regression] SPEC CPU2017 628.pop2_s miscompare

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 19 17:40:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82004

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Wilco from comment #17)
> (In reply to Jakub Jelinek from comment #15)
> > Created attachment 43464 [details]
> > gcc8-pr82004.patch
> > 
> > Thus, does this fix the miscompare?  I'll bootstrap/regtest it on
> > x86_64-linux and i686-linux, but don't have SPEC2k17 around.
> 
> It can't since the pow is in a loop:
> 
>    do n=0,nsub
>      logchl = logchl + dlogchl
>      chlamnt = 10**(logchl)

Ugh, you're right.  Despite that, I think my patch is useful anyway if the x
folds into a constant, or even just as a simpler/smaller representation through
most of the optimization passes.

With the delayed folding of this, perhaps some loop optimization could note
that we have:
  for (n = 0; n < nsub - 1; n++)
    {
      chlamnt = pow (10, constant + (n + 1) * constant2);
...
    }
and turn that (-Ofast) into
  chlamnt = pow (10, constant);
  chlamnt_step = pow (10, constant2);
  for (n = 0; n < nsub - 1; n++)
    {
      chlamnt = chlamnt * chlamnt_step;
...
    }


More information about the Gcc-bugs mailing list