Skip to content

Commit 6fc8667

Browse files
committed
[TableGen] Add tests to show wrong bits output in GenericTable
1 parent a046039 commit 6fc8667

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

llvm/test/TableGen/generic-tables.td

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,34 @@ include "llvm/TableGen/SearchableTable.td"
2525
// CHECK-LABEL: GET_ATable_IMPL
2626
// CHECK: constexpr AEntry ATable[] = {
2727
// CHECK-NOT: { "aaa"
28-
// CHECK: { "baz"
29-
// CHECK: { "foo"
30-
// CHECK: { "foobar"
31-
// CHECK: { "bar"
28+
// CHECK: { "baz", 0x2, 0x6, 0x0 },
29+
// CHECK: { "foo", 0x4, 0x4, 0x0 },
30+
// CHECK: { "foobar", 0x4, 0x5, 0x0 },
31+
// CHECK: { "bar", 0x5, 0x3, 0x0 },
3232
// CHECK: };
3333

3434
// CHECK: const AEntry *lookupATableByValues(uint8_t Val1, uint16_t Val2) {
3535
// CHECK: return &*Idx;
3636
// CHECK: }
3737

38-
class AEntry<string str, int val1, int val2> {
38+
class AEntry<string str, int val1, int val2, bits<64> val3> {
3939
string Str = str;
4040
bits<8> Val1 = val1;
4141
bits<10> Val2 = val2;
42+
bits<64> Val3 = val3;
4243
bit IsNeeded = 1;
4344
}
4445

45-
def : AEntry<"aaa", 0, 0> { let IsNeeded = 0; }
46-
def : AEntry<"bar", 5, 3>;
47-
def : AEntry<"baz", 2, 6>;
48-
def : AEntry<"foo", 4, 4>;
49-
def : AEntry<"foobar", 4, 5>;
46+
def : AEntry<"aaa", 0, 0, 0> { let IsNeeded = 0; }
47+
def : AEntry<"bar", 5, 3, 0x100000000>;
48+
def : AEntry<"baz", 2, 6, 0xFFFFFFFF00000000>;
49+
def : AEntry<"foo", 4, 4, 0b0000000000000000000000000000000100000000000000000000000000000000>;
50+
def : AEntry<"foobar", 4, 5, 4294967296>;
5051

5152
def ATable : GenericTable {
5253
let FilterClass = "AEntry";
5354
let FilterClassField = "IsNeeded";
54-
let Fields = ["Str", "Val1", "Val2"];
55+
let Fields = ["Str", "Val1", "Val2", "Val3"];
5556

5657
let PrimaryKey = ["Val1", "Val2"];
5758
let PrimaryKeyName = "lookupATableByValues";

0 commit comments

Comments
 (0)