[llvm] 6fc8667 - [TableGen] Add tests to show wrong bits output in GenericTable

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 04:31:40 PDT 2023


Author: wangpc
Date: 2023-09-25T19:31:08+08:00
New Revision: 6fc8667d05bb5689324a459bb6e9cd89b315518c

URL: https://github.com/llvm/llvm-project/commit/6fc8667d05bb5689324a459bb6e9cd89b315518c
DIFF: https://github.com/llvm/llvm-project/commit/6fc8667d05bb5689324a459bb6e9cd89b315518c.diff

LOG: [TableGen] Add tests to show wrong bits output in GenericTable

Added: 
    

Modified: 
    llvm/test/TableGen/generic-tables.td

Removed: 
    


################################################################################
diff  --git a/llvm/test/TableGen/generic-tables.td b/llvm/test/TableGen/generic-tables.td
index f604f7777b3df9b..2528448f732c67b 100644
--- a/llvm/test/TableGen/generic-tables.td
+++ b/llvm/test/TableGen/generic-tables.td
@@ -25,33 +25,34 @@ include "llvm/TableGen/SearchableTable.td"
 // CHECK-LABEL: GET_ATable_IMPL
 // CHECK: constexpr AEntry ATable[] = {
 // CHECK-NOT:   { "aaa"
-// CHECK:       { "baz"
-// CHECK:       { "foo"
-// CHECK:       { "foobar"
-// CHECK:       { "bar"
+// CHECK:       { "baz", 0x2, 0x6, 0x0 },
+// CHECK:       { "foo", 0x4, 0x4, 0x0 },
+// CHECK:       { "foobar", 0x4, 0x5, 0x0 },
+// CHECK:       { "bar", 0x5, 0x3, 0x0 },
 // CHECK: };
 
 // CHECK: const AEntry *lookupATableByValues(uint8_t Val1, uint16_t Val2) {
 // CHECK:   return &*Idx;
 // CHECK: }
 
-class AEntry<string str, int val1, int val2> {
+class AEntry<string str, int val1, int val2, bits<64> val3> {
   string Str = str;
   bits<8> Val1 = val1;
   bits<10> Val2 = val2;
+  bits<64> Val3 = val3;
   bit IsNeeded = 1;
 }
 
-def : AEntry<"aaa", 0, 0> { let IsNeeded = 0; }
-def : AEntry<"bar",    5, 3>;
-def : AEntry<"baz",    2, 6>;
-def : AEntry<"foo",    4, 4>;
-def : AEntry<"foobar", 4, 5>;
+def : AEntry<"aaa", 0, 0, 0> { let IsNeeded = 0; }
+def : AEntry<"bar",    5, 3, 0x100000000>;
+def : AEntry<"baz",    2, 6, 0xFFFFFFFF00000000>;
+def : AEntry<"foo",    4, 4, 0b0000000000000000000000000000000100000000000000000000000000000000>;
+def : AEntry<"foobar", 4, 5, 4294967296>;
 
 def ATable : GenericTable {
   let FilterClass = "AEntry";
   let FilterClassField = "IsNeeded";
-  let Fields = ["Str", "Val1", "Val2"];
+  let Fields = ["Str", "Val1", "Val2", "Val3"];
 
   let PrimaryKey = ["Val1", "Val2"];
   let PrimaryKeyName = "lookupATableByValues";


        


More information about the llvm-commits mailing list