summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitc7d4dc13a4817cf86b50aace1b68c6042e92fe22 (patch)
treed7148b3ffd3b9c7f174f62ebdc2476651c723f65 /llvm/test/TableGen
parentc1056f90ae31eab1e42b83108520b96c62e8b726 (diff)
downloadbcm5719-llvm-c7d4dc13a4817cf86b50aace1b68c6042e92fe22.tar.gz
bcm5719-llvm-c7d4dc13a4817cf86b50aace1b68c6042e92fe22.zip
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. llvm-svn: 173445
Diffstat (limited to 'llvm/test/TableGen')
-rw-r--r--llvm/test/TableGen/math.td15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/TableGen/math.td b/llvm/test/TableGen/math.td
new file mode 100644
index 00000000000..1f3a500f089
--- /dev/null
+++ b/llvm/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
+
OpenPOWER on IntegriCloud