[gsoc 2014] moving fold-const patterns to gimple

Marc Glisse marc.glisse@inria.fr
Fri Mar 14 15:55:00 GMT 2014


On Fri, 14 Mar 2014, Prathamesh Kulkarni wrote:

> I had a look at PR 14753
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14753) from the first
> link. I have tried to implement those transforms (attached patch,
> stage-1 compiled).
> I have written the transforms to operate on GENERIC.

Why not directly gimple or the .pd file?

> Is that correct ?
> The patterns mentioned in the links were:
> a) (X >> CST1) >= CST2 -> X >= CST2 << CST1
> however, an expression Y >= CST gets folded to Y > CST - 1
> so the transform I wrote:
> (X >> CST1) > CST2 -> X > CST2 << CST1

That's not the same, try X=1, CST1=1, CST2=0.

> b) (X & ~CST) == 0 -> X <= CST

Uh, that can't be true for all constants, only some with a very specific
shape (7 is 2^3-1).

-- 
Marc Glisse



More information about the Gcc mailing list