This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Miscompilation of remainder expressions
David Daney <ddaney@avtrex.com> writes:
> Andrew Haley wrote:
> > Ian Lance Taylor writes:
> > > Joe Buck <Joe.Buck@synopsys.COM> writes:
> > > > > I suggest that those who think this is a severe problem are
> > the
> > > > ones who are highly motivated to work on a solution. An
> > > > efficient solution could be tricky: you don't want to disrupt
> > > > pipelines, or interfere with optimizations that rely on
> > > > recognizing that there is a modulo.
> > > > I suspect that the best fix, in the sense of generating the
> > best
> > > code, would be to do this at the tree level. That will give loop
> > > and VRP optimizations the best chance to eliminate the test for -1.
> > > Doing it during gimplification would be easy, if perhaps rather
> > > ugly. If there are indeed several processors with this oddity,
> > > then it would even make a certain degree of sense as a
> > > target-independent option.
> > x86, x86-64, S/390, as far as I'm aware.
> >
>
> MIPS does *not* seem to suffer from this 'defect', so a target
> independent solution that caused MIPS to generate worse code would be
> bad.
To be clear, in my opinion, this should always be selected by an
option, it should never be default behaviour for any target.
Ian