> Date: Thu, 10 May 2018 14:03:10 +0200
> From: Jakub Jelinek <ja...@redhat.com>

> On Thu, May 10, 2018 at 01:51:29PM +0200, Marc Glisse wrote:
> > > > There are probably more
> > > > complicated transformations this disables.
> > > 
> > > I'm providing an example from *real* code where the
> > > transformation is bad (admittedly just for the div-div case).
> 
> Isn't the case of the posted real-world testcase that many targets have
> instructions that can do division and modulo at the same time?

Maybe they can, but they don't.  What matters is what the tested
targets actually do.

I guess it's worth repeating: for the posted case, all the
tested targets (aarch64-unknown-linux-gnu,
powerpc64-unknown-linux-gnu, x86_64-pc-linux-gnu and
mipsisa32r2el-linux-gnu) implement the div+mod in the test-case
(by constant) using the high-part of a widened multiplication
and shift.  Actually, add ARM to that.  (The only one I found
that didn't was sparc.)

> So perhaps don't punt just because of !single_use (), but punt if
> !single_use () and one of the other uses is a modulo with the same constant
> as the second division, or perhaps similarly if the first division is
> !accompanied by modulo with the same constant too?

Maybe, but I just saw no need to limit the case, and no way to
test "other uses" anyway.

brgds, H-P

Reply via email to