[llvm] [TableGen] Added submulticlass typechecking to template arg values. (PR #112904)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 19:44:49 PDT 2024


================
@@ -0,0 +1,21 @@
+// RUN: llvm-tblgen %s | FileCheck %s
+// XFAIL: vg_leak
+// CHECK:      def X0 { // C
+// CHECK-NEXT:   bit x = 1;
+// CHECK-NEXT: }
+// CHECK-NEXT: def X1 { // C
+// CHECK-NEXT:   bit x = 0;
+// CHECK-NEXT: }
+class C {
+  bit x;
+}
+multiclass M0<bits<8> Val> {
+  let x = !eq(Val, !cast<bits<8>>(-1)) in def NAME : C;
+}
+multiclass M1<bits<8> Val> {
+  let x = !eq(Val, -1) in def NAME : C;
----------------
jofrn wrote:

This should evaluate to `bit x = 0` because `-1` is and integer and `Val` is `255`.

https://github.com/llvm/llvm-project/pull/112904


More information about the llvm-commits mailing list