@@ -117,25 +117,25 @@ TEST(KnownBitsTest, AddCarryExhaustive) {
117
117
ForeachKnownBits (1 , [&](const KnownBits &KnownCarry) {
118
118
// Explicitly compute known bits of the addition by trying all
119
119
// possibilities.
120
- KnownBits Known (Bits);
121
- Known .Zero .setAllBits ();
122
- Known .One .setAllBits ();
120
+ KnownBits Exact (Bits);
121
+ Exact .Zero .setAllBits ();
122
+ Exact .One .setAllBits ();
123
123
ForeachNumInKnownBits (Known1, [&](const APInt &N1) {
124
124
ForeachNumInKnownBits (Known2, [&](const APInt &N2) {
125
125
ForeachNumInKnownBits (KnownCarry, [&](const APInt &Carry) {
126
126
APInt Add = N1 + N2;
127
127
if (Carry.getBoolValue ())
128
128
++Add;
129
129
130
- Known .One &= Add;
131
- Known .Zero &= ~Add;
130
+ Exact .One &= Add;
131
+ Exact .Zero &= ~Add;
132
132
});
133
133
});
134
134
});
135
135
136
- KnownBits KnownComputed =
136
+ KnownBits Computed =
137
137
KnownBits::computeForAddCarry (Known1, Known2, KnownCarry);
138
- EXPECT_EQ (Known, KnownComputed );
138
+ EXPECT_EQ (Exact, Computed );
139
139
});
140
140
});
141
141
});
@@ -146,16 +146,16 @@ static void TestAddSubExhaustive(bool IsAdd) {
146
146
unsigned Bits = 4 ;
147
147
ForeachKnownBits (Bits, [&](const KnownBits &Known1) {
148
148
ForeachKnownBits (Bits, [&](const KnownBits &Known2) {
149
- KnownBits Known (Bits), KnownNSW (Bits), KnownNUW (Bits),
150
- KnownNSWAndNUW (Bits);
151
- Known .Zero .setAllBits ();
152
- Known .One .setAllBits ();
153
- KnownNSW .Zero .setAllBits ();
154
- KnownNSW .One .setAllBits ();
155
- KnownNUW .Zero .setAllBits ();
156
- KnownNUW .One .setAllBits ();
157
- KnownNSWAndNUW .Zero .setAllBits ();
158
- KnownNSWAndNUW .One .setAllBits ();
149
+ KnownBits Exact (Bits), ExactNSW (Bits), ExactNUW (Bits),
150
+ ExactNSWAndNUW (Bits);
151
+ Exact .Zero .setAllBits ();
152
+ Exact .One .setAllBits ();
153
+ ExactNSW .Zero .setAllBits ();
154
+ ExactNSW .One .setAllBits ();
155
+ ExactNUW .Zero .setAllBits ();
156
+ ExactNUW .One .setAllBits ();
157
+ ExactNSWAndNUW .Zero .setAllBits ();
158
+ ExactNSWAndNUW .One .setAllBits ();
159
159
160
160
ForeachNumInKnownBits (Known1, [&](const APInt &N1) {
161
161
ForeachNumInKnownBits (Known2, [&](const APInt &N2) {
@@ -170,47 +170,47 @@ static void TestAddSubExhaustive(bool IsAdd) {
170
170
Res = N1.ssub_ov (N2, SignedOverflow);
171
171
}
172
172
173
- Known .One &= Res;
174
- Known .Zero &= ~Res;
173
+ Exact .One &= Res;
174
+ Exact .Zero &= ~Res;
175
175
176
176
if (!SignedOverflow) {
177
- KnownNSW .One &= Res;
178
- KnownNSW .Zero &= ~Res;
177
+ ExactNSW .One &= Res;
178
+ ExactNSW .Zero &= ~Res;
179
179
}
180
180
181
181
if (!UnsignedOverflow) {
182
- KnownNUW .One &= Res;
183
- KnownNUW .Zero &= ~Res;
182
+ ExactNUW .One &= Res;
183
+ ExactNUW .Zero &= ~Res;
184
184
}
185
185
186
186
if (!UnsignedOverflow && !SignedOverflow) {
187
- KnownNSWAndNUW .One &= Res;
188
- KnownNSWAndNUW .Zero &= ~Res;
187
+ ExactNSWAndNUW .One &= Res;
188
+ ExactNSWAndNUW .Zero &= ~Res;
189
189
}
190
190
});
191
191
});
192
192
193
- KnownBits KnownComputed = KnownBits::computeForAddSub (
193
+ KnownBits Computed = KnownBits::computeForAddSub (
194
194
IsAdd, /* NSW=*/ false , /* NUW=*/ false , Known1, Known2);
195
- EXPECT_TRUE (checkResult (Name, Known, KnownComputed , {Known1, Known2},
195
+ EXPECT_TRUE (checkResult (Name, Exact, Computed , {Known1, Known2},
196
196
/* CheckOptimality=*/ true ));
197
197
198
- KnownBits KnownNSWComputed = KnownBits::computeForAddSub (
198
+ KnownBits ComputedNSW = KnownBits::computeForAddSub (
199
199
IsAdd, /* NSW=*/ true , /* NUW=*/ false , Known1, Known2);
200
- EXPECT_TRUE (checkResult (Name + " nsw" , KnownNSW, KnownNSWComputed ,
200
+ EXPECT_TRUE (checkResult (Name + " nsw" , ExactNSW, ComputedNSW ,
201
201
{Known1, Known2},
202
202
/* CheckOptimality=*/ true ));
203
203
204
- KnownBits KnownNUWComputed = KnownBits::computeForAddSub (
204
+ KnownBits ComputedNUW = KnownBits::computeForAddSub (
205
205
IsAdd, /* NSW=*/ false , /* NUW=*/ true , Known1, Known2);
206
- EXPECT_TRUE (checkResult (Name + " nuw" , KnownNUW, KnownNUWComputed ,
206
+ EXPECT_TRUE (checkResult (Name + " nuw" , ExactNUW, ComputedNUW ,
207
207
{Known1, Known2},
208
208
/* CheckOptimality=*/ true ));
209
209
210
- KnownBits KnownNSWAndNUWComputed = KnownBits::computeForAddSub (
210
+ KnownBits ComputedNSWAndNUW = KnownBits::computeForAddSub (
211
211
IsAdd, /* NSW=*/ true , /* NUW=*/ true , Known1, Known2);
212
- EXPECT_TRUE (checkResult (Name + " nsw nuw" , KnownNSWAndNUW ,
213
- KnownNSWAndNUWComputed , {Known1, Known2},
212
+ EXPECT_TRUE (checkResult (Name + " nsw nuw" , ExactNSWAndNUW ,
213
+ ComputedNSWAndNUW , {Known1, Known2},
214
214
/* CheckOptimality=*/ true ));
215
215
});
216
216
});
@@ -228,25 +228,25 @@ TEST(KnownBitsTest, SubBorrowExhaustive) {
228
228
ForeachKnownBits (1 , [&](const KnownBits &KnownBorrow) {
229
229
// Explicitly compute known bits of the subtraction by trying all
230
230
// possibilities.
231
- KnownBits Known (Bits);
232
- Known .Zero .setAllBits ();
233
- Known .One .setAllBits ();
231
+ KnownBits Exact (Bits);
232
+ Exact .Zero .setAllBits ();
233
+ Exact .One .setAllBits ();
234
234
ForeachNumInKnownBits (Known1, [&](const APInt &N1) {
235
235
ForeachNumInKnownBits (Known2, [&](const APInt &N2) {
236
236
ForeachNumInKnownBits (KnownBorrow, [&](const APInt &Borrow) {
237
237
APInt Sub = N1 - N2;
238
238
if (Borrow.getBoolValue ())
239
239
--Sub;
240
240
241
- Known .One &= Sub;
242
- Known .Zero &= ~Sub;
241
+ Exact .One &= Sub;
242
+ Exact .Zero &= ~Sub;
243
243
});
244
244
});
245
245
});
246
246
247
- KnownBits KnownComputed =
247
+ KnownBits Computed =
248
248
KnownBits::computeForSubBorrow (Known1, Known2, KnownBorrow);
249
- EXPECT_EQ (Known, KnownComputed );
249
+ EXPECT_EQ (Exact, Computed );
250
250
});
251
251
});
252
252
});
0 commit comments