Test if the given value is known to have exactly one bit set.
Declared in <llvm/CodeGen/GlobalISel/Utils.h>
bool
isKnownToBeAPowerOfTwo(
Register Val,
MachineRegisterInfo const& MRI,
GISelValueTracking* ValueTracking = nullptr,
bool OrNegative = false);
This differs from computeKnownBits in that it doesn't necessarily determine which bit is set. When OrNegative is true, the value is also considered a power of two if its negation is a power of two (i.e. its absolute value is a power of two).
True if Val is known to be a power of two.
| Name | Description |
|---|---|
| Val | Register whose value is tested. |
| MRI | Register information for the function. |
| ValueTracking | Optional value-tracking analysis to consult. |
| OrNegative | Also accept values whose negation is a power of two. |