summaryrefslogtreecommitdiffstats
path: root/llvm/test/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-06-08 23:05:37 +0000
committerDavid Greene <greened@obbligato.org>2009-06-08 23:05:37 +0000
commit67c05bff319054210f6b643bed53bcb7999f1363 (patch)
tree047dfe1c9acc62fa6e62b1061ab45a9f86c0284a /llvm/test/TableGen
parent5b1b5b2a8a879a71ee78febb0c71a07f958b1405 (diff)
downloadbcm5719-llvm-67c05bff319054210f6b643bed53bcb7999f1363.tar.gz
bcm5719-llvm-67c05bff319054210f6b643bed53bcb7999f1363.zip
Add a !patsubst operator. Use on string types.
llvm-svn: 73099
Diffstat (limited to 'llvm/test/TableGen')
-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