20 bool CarryZero,
bool CarryOne) {
21 assert(!(CarryZero && CarryOne) &&
22 "Carry can't be zero and one at the same time");
28 APInt CarryKnownZero = ~(PossibleSumZero ^ LHS.
Zero ^ RHS.
Zero);
29 APInt CarryKnownOne = PossibleSumOne ^ LHS.
One ^ RHS.
One;
34 APInt CarryKnownUnion = std::move(CarryKnownZero) | CarryKnownOne;
35 APInt Known = std::move(LHSKnownUnion) & RHSKnownUnion & CarryKnownUnion;
37 assert((PossibleSumZero & Known) == (PossibleSumOne & Known) &&
38 "known bits of sum differ");
42 KnownOut.
Zero = ~
std::move(PossibleSumZero) & Known;
43 KnownOut.
One = std::move(PossibleSumOne) & Known;
60 LHS, RHS,
true,
false);
65 LHS, RHS,
false,
true);
This class represents lattice values for constants.
unsigned getBitWidth() const
Get the bit width of this value.
static KnownBits computeForAddCarry(const KnownBits &LHS, const KnownBits &RHS, bool CarryZero, bool CarryOne)
static KnownBits computeForAddSub(bool Add, bool NSW, const KnownBits &LHS, KnownBits RHS)
Compute known bits resulting from adding LHS and RHS.
bool getBoolValue() const
Convert APInt to a boolean value.
static KnownBits computeForAddCarry(const KnownBits &LHS, const KnownBits &RHS, const KnownBits &Carry)
Compute known bits resulting from adding LHS, RHS and a 1-bit Carry.
bool isNegative() const
Returns true if this value is known to be negative.
APInt getMinValue() const
Return the minimal value possible given these KnownBits.
void makeNonNegative()
Make this value non-negative.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Class for arbitrary precision integers.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isNonNegative() const
Returns true if this value is known to be non-negative.
APInt getMaxValue() const
Return the maximal value possible given these KnownBits.
void makeNegative()
Make this value negative.