aboutsummaryrefslogtreecommitdiffstats
path: root/test/TableGen
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-01-25 14:49:08 +0000
committerHal Finkel <hfinkel@anl.gov>2013-01-25 14:49:08 +0000
commitd23a41c153712b929bd84f5e713bda5db5d6e66d (patch)
tree0510f2d72a79dbbdb6f6db2438d4b7ea3006da3c /test/TableGen
parent4a9256f265a7fcccd1f04518b55fd751f3a920a8 (diff)
downloadexternal_llvm-d23a41c153712b929bd84f5e713bda5db5d6e66d.zip
external_llvm-d23a41c153712b929bd84f5e713bda5db5d6e66d.tar.gz
external_llvm-d23a41c153712b929bd84f5e713bda5db5d6e66d.tar.bz2
Add an addition operator to TableGen
This adds an !add(a, b) operator to tablegen; this will be used to cleanup the PPC register definitions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/math.td15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/TableGen/math.td b/test/TableGen/math.td
new file mode 100644
index 0000000..1f3a500
--- /dev/null
+++ b/test/TableGen/math.td
@@ -0,0 +1,15 @@
+// RUN: llvm-tblgen %s | FileCheck %s
+
+class Int<int value> {
+ int Value = value;
+}
+
+def v1024 : Int<1024>;
+// CHECK: Value = 1024
+
+def v1025 : Int<!add(v1024.Value, 1)>;
+// CHECK: Value = 1025
+
+def v2048 : Int<!add(v1024.Value, v1024.Value)>;
+// CHECK: Value = 2048
+