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).
I believe the logic in PerformCMOVCombine guarantees this will never be true. Perhaps we could change this to an assert?