[InstCombine] Fold sub(Y,and(lshr(X,C),1)) --> add(ashr(shl(X,(BW-1)-C),BW-1),Y)...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 15 Feb 2022 13:24:20 +0000 (13:24 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 15 Feb 2022 13:24:20 +0000 (13:24 +0000)
commit9606c690873fab93d895b2b763d8e2ed781c05af
tree501b28d73f872f357edcdb861dc3c11dca9d9bee
parentb7574b092a97ef59631aa3e801b6c04665409147
[InstCombine] Fold sub(Y,and(lshr(X,C),1)) --> add(ashr(shl(X,(BW-1)-C),BW-1),Y) (PR53610)

As noted on PR53610, we can fold a 'bit splat' negation of a shifted bitmask pattern into a pair of shifts.

https://alive2.llvm.org/ce/z/eGrsoN

Differential Revision: https://reviews.llvm.org/D119715
llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
llvm/test/Transforms/InstCombine/negated-bitmask.ll