summaryrefslogtreecommitdiffstats
path: root/llvm/test/TableGen/patsubst.td
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/TableGen/patsubst.td')
-rw-r--r--llvm/test/TableGen/patsubst.td15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/TableGen/patsubst.td b/llvm/test/TableGen/patsubst.td
new file mode 100644
index 00000000000..0a7b3d8219d
--- /dev/null
+++ b/llvm/test/TableGen/patsubst.td
@@ -0,0 +1,15 @@
+// RUN: tblgen %s | grep {Match1 = "v4f32"} | count 1
+// RUN: tblgen %s | grep {Match2 = "v2f64"} | count 1
+// RUN: tblgen %s | grep {Match3 = "v4f32 add"} | count 1
+// RUN: tblgen %s | grep {Match4 = "v2f64 add"} | count 1
+
+class Foo<string v> {
+ string Value = v;
+ string Match1 = !patsubst(".*ps$", "v4f32", v);
+ string Match2 = !patsubst(".*pd$", "v2f64", v);
+ string Match3 = !patsubst("(.*)ps$", "v4f32 $1", v);
+ string Match4 = !patsubst("(.*)pd$", "v2f64 $1", v);
+}
+
+def Bar : Foo<"addps">;
+def Baz : Foo<"addpd">;
OpenPOWER on IntegriCloud