This is the mail archive of the gcc@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: Miscompilation of remainder expressions


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.

If we think it's too ugly to do it in the target independent code,
then it's trivial to do it by changing the divmodsi4 define_expand in
config/i386/i386.md.

Ian


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