Lines Matching refs:IntegralAP
33 template <bool Signed> class IntegralAP final {
35 friend IntegralAP<!Signed>;
56 using AsUnsigned = IntegralAP<false>;
59 IntegralAP(T Value, unsigned BitWidth) in IntegralAP() function
62 IntegralAP(APInt V) : V(V) {} in IntegralAP() function
64 IntegralAP() : IntegralAP(-1, 3) {} in IntegralAP() function
66 IntegralAP operator-() const { return IntegralAP(-V); }
67 IntegralAP operator-(const IntegralAP &Other) const {
68 return IntegralAP(V - Other.V);
70 bool operator>(const IntegralAP &RHS) const {
75 bool operator>=(IntegralAP RHS) const {
80 bool operator<(IntegralAP RHS) const {
85 bool operator<=(IntegralAP RHS) const {
96 template <typename T> static IntegralAP from(T Value, unsigned NumBits = 0) {
100 return IntegralAP<Signed>(Copy);
104 static IntegralAP from(IntegralAP<InputSigned> V, unsigned NumBits = 0) {
109 return IntegralAP<Signed>(V.V.sextOrTrunc(NumBits));
110 return IntegralAP<Signed>(V.V.zextOrTrunc(NumBits));
114 static IntegralAP from(Integral<Bits, InputSigned> I, unsigned BitWidth) { in from()
117 return IntegralAP<Signed>(Copy); in from()
120 static IntegralAP zero(int32_t BitWidth) { in zero()
122 return IntegralAP(V); in zero()
156 IntegralAP truncate(unsigned BitWidth) const { in truncate()
158 return IntegralAP(V.trunc(BitWidth).sextOrTrunc(this->bitWidth())); in truncate()
160 return IntegralAP(V.trunc(BitWidth).zextOrTrunc(this->bitWidth())); in truncate()
163 IntegralAP<false> toUnsigned() const { in toUnsigned()
165 return IntegralAP<false>(Copy); in toUnsigned()
168 ComparisonCategoryResult compare(const IntegralAP &RHS) const { in compare()
187 static bool increment(IntegralAP A, IntegralAP *R) { in increment()
188 IntegralAP<Signed> One(1, A.bitWidth()); in increment()
192 static bool decrement(IntegralAP A, IntegralAP *R) { in decrement()
193 IntegralAP<Signed> One(1, A.bitWidth()); in decrement()
197 static bool add(IntegralAP A, IntegralAP B, unsigned OpBits, IntegralAP *R) { in add()
201 static bool sub(IntegralAP A, IntegralAP B, unsigned OpBits, IntegralAP *R) { in sub()
205 static bool mul(IntegralAP A, IntegralAP B, unsigned OpBits, IntegralAP *R) { in mul()
209 static bool rem(IntegralAP A, IntegralAP B, unsigned OpBits, IntegralAP *R) { in rem()
211 *R = IntegralAP(A.V.srem(B.V)); in rem()
213 *R = IntegralAP(A.V.urem(B.V)); in rem()
217 static bool div(IntegralAP A, IntegralAP B, unsigned OpBits, IntegralAP *R) { in div()
219 *R = IntegralAP(A.V.sdiv(B.V)); in div()
221 *R = IntegralAP(A.V.udiv(B.V)); in div()
225 static bool bitAnd(IntegralAP A, IntegralAP B, unsigned OpBits, in bitAnd()
226 IntegralAP *R) { in bitAnd()
227 *R = IntegralAP(A.V & B.V); in bitAnd()
231 static bool bitOr(IntegralAP A, IntegralAP B, unsigned OpBits, in bitOr()
232 IntegralAP *R) { in bitOr()
233 *R = IntegralAP(A.V | B.V); in bitOr()
237 static bool bitXor(IntegralAP A, IntegralAP B, unsigned OpBits, in bitXor()
238 IntegralAP *R) { in bitXor()
239 *R = IntegralAP(A.V ^ B.V); in bitXor()
243 static bool neg(const IntegralAP &A, IntegralAP *R) { in neg()
246 *R = IntegralAP(AI); in neg()
250 static bool comp(IntegralAP A, IntegralAP *R) { in comp()
251 *R = IntegralAP(~A.V); in comp()
255 static void shiftLeft(const IntegralAP A, const IntegralAP B, unsigned OpBits, in shiftLeft()
256 IntegralAP *R) { in shiftLeft()
257 *R = IntegralAP(A.V.shl(B.V.getZExtValue())); in shiftLeft()
260 static void shiftRight(const IntegralAP A, const IntegralAP B, in shiftRight()
261 unsigned OpBits, IntegralAP *R) { in shiftRight()
264 *R = IntegralAP(A.V.ashr(ShiftAmount)); in shiftRight()
266 *R = IntegralAP(A.V.lshr(ShiftAmount)); in shiftRight()
284 static IntegralAP<Signed> deserialize(const std::byte *Buff) { in deserialize()
287 IntegralAP<Signed> Val(APInt(BitWidth, 0ull, !Signed)); in deserialize()
296 static bool CheckAddSubMulUB(const IntegralAP &A, const IntegralAP &B, in CheckAddSubMulUB()
297 unsigned BitWidth, IntegralAP *R) { in CheckAddSubMulUB()
315 IntegralAP<Signed> I) {
321 IntegralAP<Signed> getSwappedBytes(IntegralAP<Signed> F) { in getSwappedBytes()