On Thu, May 10, 2018 at 10:33:39AM +0200, Marc Glisse wrote:
> (not a review)
> 
> On Thu, 10 May 2018, Hans-Peter Nilsson wrote:
> 
> >Replacing a division feeding a division helps only when the
> >second division is the only user, and "fusing" the divisions is
> 
> Well, that's not quite true.
> int x, y;
> void f(int n){
>   int c = 3 << 20;
>   x = n / c;
>   y = x / c;
> }

[ fixed the typo ]

> Here we can optimize the last division to y = 0. After your patch, we 
> likely need VRP to do that simplification. There are probably more 
> complicated transformations this disables.

Without the replacement we have two dependent divisions; with the
replacement we have two independent divisions, and that is much faster
on some (many?) systems (that can do two fixed-point divisions in parallel),
even if things do not simplify further.


Segher

Reply via email to