Skip to content

Commit 68f38db

Browse files
authored
[TableGen] Add list value test for switch(NFC) (#202327)
1 parent 50088e2 commit 68f38db

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

llvm/test/TableGen/switch.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ def labeled_99 : Labeled<99>;
5858
// CHECK: string_key = "v1";
5959
// CHECK: bits_val = { 1, 1 };
6060
// CHECK: single_bit = 1;
61+
// CHECK: list_val = [7, 8, 9];
6162
def nonempty_caselist_default {
6263
string color = !switch(99, 1: "red", 2: "green", 3: "blue", "default");
6364
int age = !switch(99, 1: 20, 2: 30, 3: 40, 10);
6465
Rec rec_val = !switch(99, 1: rec_b, 2: rec_c, 3: rec_d, rec_a);
6566
string string_key = !switch("k99", "k1": "v2", "k2": "v3", "k3": "v4", "v1");
6667
bits<2> bits_val = !switch(99, 1: {0, 1}, 2: {1, 0}, {1, 1});
6768
bit single_bit = !switch(99, 1: !eq(0, 0), 2: !eq(0, 1), !eq(1, 1));
69+
list<int> list_val = !switch(99, 1: [1, 2, 3], 2: [4, 5, 6], [7, 8, 9]);
6870
}
6971

7072
// Non-empty case list, key matches a case key
@@ -75,13 +77,15 @@ def nonempty_caselist_default {
7577
// CHECK: string_key = "v2";
7678
// CHECK: bits_val = { 1, 0 };
7779
// CHECK: single_bit = 0;
80+
// CHECK: list_val = [4, 5, 6];
7881
def nonempty_caselist_match_case {
7982
string color = !switch(1, 1: "red", 2: "green", 3: "blue", "default");
8083
int age = !switch(2, 1: 20, 2: 30, 3: 40, 10);
8184
Rec rec_val = !switch(3, 1: rec_b, 2: rec_c, 3: rec_d, rec_a);
8285
string string_key = !switch("k1", "k1": "v2", "k2": "v3", "k3": "v4", "v1");
8386
bits<2> bits_val = !switch(2, 1: {0, 1}, 2: {1, 0}, {1, 1});
8487
bit single_bit = !switch(2, 1: !eq(0, 0), 2: !eq(0, 1), !eq(1, 1));
88+
list<int> list_val = !switch(2, 1: [1, 2, 3], 2: [4, 5, 6], [7, 8, 9]);
8589
}
8690

8791
// Partially unset values

0 commit comments

Comments
 (0)