[PATCH] D113037: [InstCombine] (~a & b & c) | ~(a | b) -> (c | ~b) & ~a

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 12:53:22 PST 2021


rampitec planned changes to this revision.
rampitec added a comment.

In the light of D113526 <https://reviews.llvm.org/D113526> this needs to be rebased and handle inverted pattern:

  (~a | b | c) & ~(a & b) -> (c & ~b) | ~a

  define i4 @src(i4 %a, i4 %b, i4 %c) {
    %and1 = and i4 %b, %a
    %not1 = xor i4 %and1, -1
    %not2 = xor i4 %a, -1
    %or1 = or i4 %b, %not2
    %or2 = or i4 %or1, %c
    %and2 = and i4 %or2, %not1
    ret i4 %and2
  }
  
  define i4 @tgt(i4 %a, i4 %b, i4 %c) {
    %notb = xor i4 %b, -1
    %and = and i4 %notb, %c
    %nota = xor i4 %a, -1
    %or = or i4 %and, %nota
    ret i4 %or
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113037/new/

https://reviews.llvm.org/D113037



More information about the llvm-commits mailing list