Re: [PATCH] POPCOUNT folding optimizations

2018-05-24 Thread Marc Glisse
On Thu, 24 May 2018, Jeff Law wrote: +    case LSHIFT_EXPR: +  if (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST) Maybe check INTEGRAL_TYPE_P as well, like you did for PLUS_EXPR? Or was that also unnecessary for PLUS_EXPR? While there may be cases where allowing an INTEGRAL_TYPE_P SSA_NA

Re: [PATCH] POPCOUNT folding optimizations

2018-05-24 Thread Jeff Law
On 05/01/2018 02:42 AM, Marc Glisse wrote: > (I am not a reviewer, just commenting) But your comments are definitely appreciated! > > On Fri, 9 Feb 2018, Roger Sayle wrote: > >> The following patch implements a number of __builtin_popcount related >> optimizations. >> (i) popcount(x) == 0 can be

Re: [PATCH] POPCOUNT folding optimizations

2018-05-01 Thread Jeff Law
On 05/01/2018 02:48 AM, Marc Glisse wrote: > On Mon, 30 Apr 2018, Jeff Law wrote: > >> On 02/09/2018 05:42 AM, Roger Sayle wrote: >>> The following patch implements a number of __builtin_popcount related >>> optimizations. >>> (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to

Re: [PATCH] POPCOUNT folding optimizations

2018-05-01 Thread Marc Glisse
On Mon, 30 Apr 2018, Jeff Law wrote: On 02/09/2018 05:42 AM, Roger Sayle wrote: The following patch implements a number of __builtin_popcount related optimizations. (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to x!=0. (ii) popcount(x&1) can be simplified to x&1, and for

Re: [PATCH] POPCOUNT folding optimizations

2018-05-01 Thread Marc Glisse
(I am not a reviewer, just commenting) On Fri, 9 Feb 2018, Roger Sayle wrote: The following patch implements a number of __builtin_popcount related optimizations. (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to x!=0. (ii) popcount(x&1) can be simplified to x&1, and for u

Re: [PATCH] POPCOUNT folding optimizations

2018-04-30 Thread Jeff Law
On 02/09/2018 05:42 AM, Roger Sayle wrote: > The following patch implements a number of __builtin_popcount related > optimizations. > (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to > x!=0. > (ii) popcount(x&1) can be simplified to x&1, and for unsigned x, > popcount(x>>31)

Re: [PATCH] POPCOUNT folding optimizations

2018-02-10 Thread Jeff Law
On 02/09/2018 05:42 AM, Roger Sayle wrote: > > The following patch implements a number of __builtin_popcount related > optimizations. > (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to > x!=0. > (ii) popcount(x&1) can be simplified to x&1, and for unsigned x, > popcount(x>>3

[PATCH] POPCOUNT folding optimizations

2018-02-09 Thread Roger Sayle
The following patch implements a number of __builtin_popcount related optimizations. (i) popcount(x) == 0 can be simplified to x==0, and popcount(x) != 0 to x!=0. (ii) popcount(x&1) can be simplified to x&1, and for unsigned x, popcount(x>>31) to x>>31. (iii) popcount (x&6) + popcount(y&16) can be