Existing LIR recognizes CTLZ where shifting input variable right until it is zero. (Shift-Until-Zero idiom)
This commit:
- augment Shift-Until-Zero idiom to recognize CTTZ where input variable is shifted left.
- Add a second idiom recognition (BitScan idiom) where bits of input variable are scanned in order until hit a set bit: scan-from-left-to-right means CTLZ; scan-from-right-to-left means CTTZ. The starting bit index do not have to be first bit if we could prove from CFG that preceding bits are zero.
Related PR: llvm.org/PR17087
No need to make IntrinID or InitShift const.