[ARM] Fold And/Or into CSel if possible
authorDavid Green <david.green@arm.com>
Mon, 9 Jan 2023 13:28:57 +0000 (13:28 +0000)
committerDavid Green <david.green@arm.com>
Mon, 9 Jan 2023 13:28:57 +0000 (13:28 +0000)
commit90f24bef47227d58f2ccdcc481ca22eff32248ca
tree86e911aedd4aa039a63ae63c36915ef2b750ad7b
parent6b9317f52a66318a57a216da2e5e4890ef2aef7b
[ARM] Fold And/Or into CSel if possible

This is the ARM equivalent of D141119, where we fold `and x, (csel 0, 1, cc)`
to `csel ZR, x, cc` if we know that x is 0/1 and for `or x, (csel 0, 1, cc)`
emit `csinc x, ZR, cc`. The or pattern gets recognized from a cmov under Arm.

Differential Revision: https://reviews.llvm.org/D141137
14 files changed:
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/test/CodeGen/Thumb2/LowOverheadLoops/fast-fp-loops.ll
llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-float-loops.ll
llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-tail-data-types.ll
llvm/test/CodeGen/Thumb2/csel-andor-onebit.ll
llvm/test/CodeGen/Thumb2/mve-nounrolledremainder.ll
llvm/test/CodeGen/Thumb2/mve-pred-and.ll
llvm/test/CodeGen/Thumb2/mve-pred-or.ll
llvm/test/CodeGen/Thumb2/mve-vcmp.ll
llvm/test/CodeGen/Thumb2/mve-vcmpf.ll
llvm/test/CodeGen/Thumb2/mve-vcmpfr.ll
llvm/test/CodeGen/Thumb2/mve-vcmpfz.ll
llvm/test/CodeGen/Thumb2/mve-vcmpr.ll