Test if the given value is known to have exactly one bit set.
Synopsis
Declared in <llvm/CodeGen/GlobalISel/Utils.h>
bool
isKnownToBeAPowerOfTwo(
Register Val,
MachineRegisterInfo const& MRI,
GISelValueTracking* ValueTracking = nullptr,
bool OrNegative = false);
Description
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).
Return Value
True if Val is known to be a power of two.
Parameters
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. |
Created with MrDocs