Basically this patch transforms
(1 << X) & C -> (X == lg(C)) ? (1 << X) : 0, if C is Power of 2
(1 << X) & C -> (X < lg(C+1)) ? (1 << X) : 0, if C + 1 is Power of 2
This patch can handles following cases from http://nondot.org/sabre/LLVMNotes/InstCombine.txt
if (!((1 << which_alternative) & 0x3)) --> if (which_alternative >= 2)
if (((1 << which_alternative) & 0x7)) --> if (which_alternative < 3)
I need suggestion regarding this
- Names for comp and select instruction, for now, it is getting set automatically.
- Do we have to have check if X is not greater than the bit-width
- If check for the last of added test-case is ok.