Reapply [AArch64] fold subs ugt/ult to ands when the second operand is mask/pow2
authorchenglin.bi <chenglin.bi@linaro.org>
Wed, 18 Jan 2023 11:23:58 +0000 (19:23 +0800)
committerchenglin.bi <chenglin.bi@linaro.org>
Wed, 18 Jan 2023 11:24:20 +0000 (19:24 +0800)
commit45299fb0f99cd94aeb33d954c4d68123a0bc7e9e
tree3837bc471f863ee952b3bfa1275348c8130f5877
parentd8a1d5024fe88ea61ce57f624bade4d313acd1b2
Reapply [AArch64] fold subs ugt/ult to ands when the second operand is mask/pow2

Origianl patch made a mistake that ugt is reverse cc should be ule.
And ule < C will be generalize to ult < C + 1. So the new patch add support for ult < Pow2 case.

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

Reviewed By: samtebbs, chapuni

Differential Revision: https://reviews.llvm.org/D141829
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/and-mask-removal.ll
llvm/test/CodeGen/AArch64/andcompare.ll