[ARM] Combine CMOV into BFI where possible
authorJames Molloy <james.molloy@arm.com>
Wed, 4 Nov 2015 16:55:07 +0000 (16:55 +0000)
committerJames Molloy <james.molloy@arm.com>
Wed, 4 Nov 2015 16:55:07 +0000 (16:55 +0000)
commit447c9ea9e1aa98e11664645d0772071c912301f0
treef68809113271ca550daef1e799d1318fc0b21c07
parentd2e0ff3b7ff356f47973647da7cd90f8a4962bb9
[ARM] Combine CMOV into BFI where possible

If we have a CMOV, OR and AND combination such as:
  if (x & CN)
    y |= CM;

And:
  * CN is a single bit;
  * All bits covered by CM are known zero in y;

Then we can convert this to a sequence of BFI instructions. This will always be a win if CM is a single bit, will always be no worse than the TST & OR sequence if CM is two bits, and for thumb will be no worse if CM is three bits (due to the extra IT instruction).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252057 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h
test/CodeGen/ARM/bfi.ll