Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-25 Thread Li Jia He
Hi, On 2020/2/24 4:16 PM, Marc Glisse wrote: On Mon, 24 Feb 2020, Li Jia He wrote: Hi, On 2020/2/22 11:12 PM, Marc Glisse wrote: On Tue, 18 Feb 2020, Li Jia He wrote: Also the pattern doing the standalone transform does /* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR,    

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-24 Thread Marc Glisse
On Mon, 24 Feb 2020, Li Jia He wrote: Hi, On 2020/2/22 11:12 PM, Marc Glisse wrote: On Tue, 18 Feb 2020, Li Jia He wrote: Also the pattern doing the standalone transform does /* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR,     i.e. "X % C" into "X & (C - 1)", if X and C ar

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-23 Thread Li Jia He
Hi, On 2020/2/22 11:12 PM, Marc Glisse wrote: On Tue, 18 Feb 2020, Li Jia He wrote: Also the pattern doing the standalone transform does /* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR,     i.e. "X % C" into "X & (C - 1)", if X and C are positive.     Also optimize A % (C <<

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-22 Thread Marc Glisse
On Tue, 18 Feb 2020, Li Jia He wrote: Also the pattern doing the standalone transform does /* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR, i.e. "X % C" into "X & (C - 1)", if X and C are positive. Also optimize A % (C << N) where C is a power of 2, to A & ((C << N

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-17 Thread Li Jia He
Hi, On 2020/2/17 4:30 PM, Richard Biener wrote: On Mon, 17 Feb 2020, Jakub Jelinek wrote: On Mon, Feb 17, 2020 at 09:01:13AM +0100, Richard Biener wrote: On Mon, 17 Feb 2020, Li Jia He wrote: This patch wants to fix PR66552 on gimple and optimizes (x shift (n mod C)) to (x shift (n bit_and (

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-17 Thread Jiufu Guo
Li Jia He writes: > Hi, > @@ -546,6 +546,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > (simplify >(mod (mod@2 @0 @1) @1) >@2) > + /* Optimize (x shift (n mod C)) to (x shift (n bit_and (C - 1))) when C is a > +constant and power of two. */ > + (for shift (lshift rshift) > + (simpli

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-17 Thread Richard Biener
On Mon, 17 Feb 2020, Jakub Jelinek wrote: > On Mon, Feb 17, 2020 at 09:01:13AM +0100, Richard Biener wrote: > > On Mon, 17 Feb 2020, Li Jia He wrote: > > > This patch wants to fix PR66552 on gimple and optimizes (x shift (n mod > > > C)) > > > to (x shift (n bit_and (C - 1))) when C is a constant

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-17 Thread Jakub Jelinek
On Mon, Feb 17, 2020 at 09:01:13AM +0100, Richard Biener wrote: > On Mon, 17 Feb 2020, Li Jia He wrote: > > This patch wants to fix PR66552 on gimple and optimizes (x shift (n mod C)) > > to (x shift (n bit_and (C - 1))) when C is a constant and power of two as > > discussed in PR66552. > > > > Th

Re: [PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-17 Thread Richard Biener
On Mon, 17 Feb 2020, Li Jia He wrote: > Hi, > > This patch wants to fix PR66552 on gimple and optimizes (x shift (n mod C)) > to (x shift (n bit_and (C - 1))) when C is a constant and power of two as > discussed in PR66552. > > The regression testing for the patch was done on GCC mainline on >

[PATCH] Fix PR66552, Missed optimization when shift amount is result of signed modulus

2020-02-16 Thread Li Jia He
Hi, This patch wants to fix PR66552 on gimple and optimizes (x shift (n mod C)) to (x shift (n bit_and (C - 1))) when C is a constant and power of two as discussed in PR66552. The regression testing for the patch was done on GCC mainline on powerpc64le-unknown-linux-gnu (Power 9 LE) with no