Page MenuHomePhabricator

[InstCombine] sub(xor(x, y), or(x, y)) -> neg(and(x, y))
ClosedPublic

Authored by xbolva00 on Wed, Sep 4, 10:36 AM.

Details

Summary
Name: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
%or = or i32 %y, %x
%xor = xor i32 %x, %y
%sub = sub i32 %xor, %or
  =>
%sub1 = and i32 %x, %y
%sub = sub i32 0, %sub1

Optimization: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
Done: 1
Optimization is correct!

https://rise4fun.com/Alive/8OI

Diff Detail

Repository
rL LLVM

Event Timeline

xbolva00 created this revision.Wed, Sep 4, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Sep 4, 10:36 AM
lebedev.ri accepted this revision.Wed, Sep 4, 10:57 AM

LG, thanks.

I wonder what other similar 3-instruction folds are missing.

This revision is now accepted and ready to land.Wed, Sep 4, 10:57 AM
This revision was automatically updated to reflect the committed changes.

Thank you.

Next one which we miss: (~a & b) ^ a -> (a | b)