Lines Matching full:a

4  * A tnum tracks knowledge about the bits of a value.  Each bit can be either
13 /* A completely unknown value */
37 struct tnum tnum_lshift(struct tnum a, u8 shift) in tnum_lshift() argument
39 return TNUM(a.value << shift, a.mask << shift); in tnum_lshift()
42 struct tnum tnum_rshift(struct tnum a, u8 shift) in tnum_rshift() argument
44 return TNUM(a.value >> shift, a.mask >> shift); in tnum_rshift()
47 struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness) in tnum_arshift() argument
49 /* if a.value is negative, arithmetic shifting by minimum shift in tnum_arshift()
51 * If a.value is nonnegative, arithmetic shifting by minimum shift in tnum_arshift()
55 return TNUM((u32)(((s32)a.value) >> min_shift), in tnum_arshift()
56 (u32)(((s32)a.mask) >> min_shift)); in tnum_arshift()
58 return TNUM((s64)a.value >> min_shift, in tnum_arshift()
59 (s64)a.mask >> min_shift); in tnum_arshift()
62 struct tnum tnum_add(struct tnum a, struct tnum b) in tnum_add() argument
66 sm = a.mask + b.mask; in tnum_add()
67 sv = a.value + b.value; in tnum_add()
70 mu = chi | a.mask | b.mask; in tnum_add()
74 struct tnum tnum_sub(struct tnum a, struct tnum b) in tnum_sub() argument
78 dv = a.value - b.value; in tnum_sub()
79 alpha = dv + a.mask; in tnum_sub()
82 mu = chi | a.mask | b.mask; in tnum_sub()
86 struct tnum tnum_and(struct tnum a, struct tnum b) in tnum_and() argument
90 alpha = a.value | a.mask; in tnum_and()
92 v = a.value & b.value; in tnum_and()
96 struct tnum tnum_or(struct tnum a, struct tnum b) in tnum_or() argument
100 v = a.value | b.value; in tnum_or()
101 mu = a.mask | b.mask; in tnum_or()
105 struct tnum tnum_xor(struct tnum a, struct tnum b) in tnum_xor() argument
109 v = a.value ^ b.value; in tnum_xor()
110 mu = a.mask | b.mask; in tnum_xor()
128 struct tnum tnum_mul(struct tnum a, struct tnum b) in tnum_mul() argument
133 pi = a.value * b.value; in tnum_mul()
134 acc = hma(TNUM(pi, 0), a.mask, b.mask | b.value); in tnum_mul()
135 return hma(acc, b.mask, a.value); in tnum_mul()
138 /* Note that if a and b disagree - i.e. one has a 'known 1' where the other has
139 * a 'known 0' - this will return a 'known 1' for that bit.
141 struct tnum tnum_intersect(struct tnum a, struct tnum b) in tnum_intersect() argument
145 v = a.value | b.value; in tnum_intersect()
146 mu = a.mask & b.mask; in tnum_intersect()
150 struct tnum tnum_cast(struct tnum a, u8 size) in tnum_cast() argument
152 a.value &= (1ULL << (size * 8)) - 1; in tnum_cast()
153 a.mask &= (1ULL << (size * 8)) - 1; in tnum_cast()
154 return a; in tnum_cast()
157 bool tnum_is_aligned(struct tnum a, u64 size) in tnum_is_aligned() argument
161 return !((a.value | a.mask) & (size - 1)); in tnum_is_aligned()
164 bool tnum_in(struct tnum a, struct tnum b) in tnum_in() argument
166 if (b.mask & ~a.mask) in tnum_in()
168 b.value &= ~a.mask; in tnum_in()
169 return a.value == b.value; in tnum_in()
172 int tnum_strn(char *str, size_t size, struct tnum a) in tnum_strn() argument
174 return snprintf(str, size, "(%#llx; %#llx)", a.value, a.mask); in tnum_strn()
178 int tnum_sbin(char *str, size_t size, struct tnum a) in tnum_sbin() argument
184 if (a.mask & 1) in tnum_sbin()
186 else if (a.value & 1) in tnum_sbin()
191 a.mask >>= 1; in tnum_sbin()
192 a.value >>= 1; in tnum_sbin()
198 struct tnum tnum_subreg(struct tnum a) in tnum_subreg() argument
200 return tnum_cast(a, 4); in tnum_subreg()
203 struct tnum tnum_clear_subreg(struct tnum a) in tnum_clear_subreg() argument
205 return tnum_lshift(tnum_rshift(a, 32), 32); in tnum_clear_subreg()
208 struct tnum tnum_const_subreg(struct tnum a, u32 value) in tnum_const_subreg() argument
210 return tnum_or(tnum_clear_subreg(a), tnum_const(value)); in tnum_const_subreg()