Re: [PATCH] [tree-optimization] Optimize or+and+or pattern to and+or

2020-11-30 Thread Jeff Law via Gcc-patches
On 11/22/20 6:35 PM, Eugene Rozenfeld via Gcc-patches wrote: > Simplify > ((b | c) & a) | b > to > (a & c) | b. > > This fixes PR96679. > > Tested on x86_64-pc-linux-gnu. > > int f(int a, int b, int c) > { > return ((b | c) & a) | b; > } > > Code without the patch: > or edx,esi > and

[PATCH] [tree-optimization] Optimize or+and+or pattern to and+or

2020-11-22 Thread Eugene Rozenfeld via Gcc-patches
Simplify ((b | c) & a) | b to (a & c) | b. This fixes PR96679. Tested on x86_64-pc-linux-gnu. int f(int a, int b, int c) { return ((b | c) & a) | b; } Code without the patch: or edx,esi andedx,edi moveax,edx or eax,esi ret Code with the patch: andedi,edx mov