[AArch64] Fold And/Or into CSel if possible
authorDavid Green <david.green@arm.com>
Mon, 9 Jan 2023 11:52:37 +0000 (11:52 +0000)
committerDavid Green <david.green@arm.com>
Mon, 9 Jan 2023 11:52:37 +0000 (11:52 +0000)
commit07d6af6a71001c3d3a7aae21085646e642fbb56c
treedaf0325147e0fe0ef381d18a1d9f64d9214dc302
parent6d839621da8d0d85552c741c4c72369b4ada97c4
[AArch64] Fold And/Or into CSel if possible

If we have `and x, (csel 0, 1, cc)` and we know that x is 0/1, then we
can emit a `csel ZR, x, cc`. Similarly for `or x, (csel 0, 1, cc)` we
can emit `csinc x, ZR, cc`. This can help where we can not otherwise
general ccmp instructions.

Differential Revision: https://reviews.llvm.org/D141119
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/test/CodeGen/AArch64/arm64-ccmp.ll
llvm/test/CodeGen/AArch64/bcmp.ll
llvm/test/CodeGen/AArch64/csel-andor-onebit.ll
llvm/test/CodeGen/AArch64/i128-math.ll
llvm/test/CodeGen/AArch64/mul-cmp.ll
llvm/test/CodeGen/AArch64/umulo-128-legalisation-lowering.ll
llvm/test/CodeGen/AArch64/vec_umulo.ll