forked from OSchip/llvm-project
[unittest] Do not convert large unsigned long to isl::val
Currently the isl::val constructor only takes a signed long as parameter, which on Windows is only 32 bit large and can consequently not be used to obtain the same result when loading from the expression '(1ull << 32) - 1)' that we get when loading this value via isl_val_int_from_ui or when loading the value on Linux systems with 64 bit long data types. We avoid this issue by performing the shift and subtractiong within the isl::val. It would be nice to teach the isl++ bindings to construct isl::val from other integer types, but the current interface is not sufficient to do so. If constructors from both signed long and unsigned long are exposed, then integer literals that are of type 'int' and which must be converted to 'long' to match the constructor have two ambigious constructors to choose from, which result in a compiler error. The right solution is likely to additionally expose constructors from signed and unsigned int, but these are not yet available in the isl C interface and adding those adhoc to our bindings is something I would like to avoid for now. We should address this issue with a proper discussion on the isl side. llvm-svn: 297522
This commit is contained in:
parent
bfe263352a
commit
9cc7e3561d
|
@ -140,7 +140,7 @@ TEST(Isl, APIntToIslVal) {
|
|||
{
|
||||
APInt APNOne(32, (1ull << 32) - 1, false);
|
||||
auto IslNOne = valFromAPInt(IslCtx, APNOne, false);
|
||||
auto IslRef = isl::val(IslCtx, (1ull << 32) - 1);
|
||||
auto IslRef = isl::val(IslCtx, 32).two_exp().sub_ui(1);
|
||||
EXPECT_EQ(IslNOne, IslRef);
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ TEST(Isl, IslValToAPInt) {
|
|||
}
|
||||
|
||||
{
|
||||
auto IslNOne = isl::val(IslCtx, (1ull << 32) - 1);
|
||||
auto IslNOne = isl::val(IslCtx, 32).two_exp().sub_ui(1);
|
||||
auto APNOne = APIntFromVal(IslNOne);
|
||||
EXPECT_EQ((1ull << 32) - 1, APNOne);
|
||||
EXPECT_EQ(33u, APNOne.getBitWidth());
|
||||
|
|
Loading…
Reference in New Issue