Binary and decimal values were reconginzed by strtoll, which returns error when the msb is 1, and the error was ignored, resulting to wrong results. This patch fixes the issue. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D157079
37 lines
2.2 KiB
TableGen
37 lines
2.2 KiB
TableGen
// RUN: llvm-tblgen -print-records %s | FileCheck %s
|
|
// RUN: not llvm-tblgen -DOOR1 -print-records %s 2>&1 | FileCheck %s --check-prefix=CHECK-OOR
|
|
// RUN: not llvm-tblgen -DOOR2 -print-records %s 2>&1 | FileCheck %s --check-prefix=CHECK-OOR
|
|
// RUN: not llvm-tblgen -DOOR3 -print-records %s 2>&1 | FileCheck %s --check-prefix=CHECK-OOR
|
|
|
|
def {
|
|
|
|
#ifdef OOR1
|
|
bits<64> Val = -9223372036854775809;
|
|
#endif
|
|
|
|
#ifdef OOR2
|
|
bits<64> Val = 0b10000000000000000000000000000000000000000000000000000000000000000;
|
|
#endif
|
|
|
|
#ifdef OOR3
|
|
bits<64> Val = 0x10000000000000000;
|
|
#endif
|
|
// CHECK-OOR: error: Number out of range
|
|
|
|
bits<64> BinVal0 = 0x8000000000000000;
|
|
bits<64> HexVal0 = 0b1000000000000000000000000000000000000000000000000000000000000000;
|
|
bits<64> DecVal0_0 = 9223372036854775808;
|
|
bits<64> DecVal0_1 = -9223372036854775808;
|
|
|
|
bits<64> HexVal1 = 0x8000000000000001;
|
|
bits<64> DecVal1 = 9223372036854775809;
|
|
|
|
// CHECK: bits<64> BinVal0 = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
// CHECK: bits<64> HexVal0 = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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