This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch][PR91504] Inlining misses some logical operation folding


On Mon, Aug 26, 2019 at 02:04:25PM +0200, Richard Biener wrote:
> On Mon, 26 Aug 2019, kamlesh kumar wrote:
> > +/* (~a & b) ^ a  -->   (a | b)   */
> > +(simplify
> > + (bit_xor:c (bit_and:cs (bit_not @0) @1) @0)
> > + (bit_ior @0 @1))
> > +
> 
> Are you sure?
> 
> (~1804289383 & 846930886) ^ 1804289383 != 1804289383 | 846930886

Both are hex 7bfb67e7.

a|b = a|(b&~a) = a^(b&~a)

>       if ((~a & b) ^ a != a | b)

!= has higher precedence than ^ and | (and &).


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]