Related to https://bugs.llvm.org/show_bug.cgi?id=28668.
Checking whether a number has a certain number of trailing / leading zeros means checking whether it is of the form 0001XXXX or XXXX1000, which can be done with an and+icmp.
This is the first step, handling only eq/ne predicates, as that's what the existing code does. I'd like to extend this to handle all predicate types in the next step, which would resolve https://github.com/rust-lang/rust/issues/43024.
We have to check hasOneUse() on the intrinsic, or we'll end up with extra instructions for an example like this:
In cases where the 'and' gets removed, you don't need the one-use restriction, but I'm not sure if it's worth trying to differentiate those from the general case.