summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2015-07-14 21:13:29 +0000
committerJF Bastien <jfb@google.com>2015-07-14 21:13:29 +0000
commitd9767a368fb7d425bbc7bec6d02afb596c232c34 (patch)
tree903cb93e8743cc92439d74f57fab3e06eccc7603 /llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
parentfdfaae42b6e2a3f3f6f8ab963a0cf165eda398de (diff)
downloadbcm5719-llvm-d9767a368fb7d425bbc7bec6d02afb596c232c34.tar.gz
bcm5719-llvm-d9767a368fb7d425bbc7bec6d02afb596c232c34.zip
WebAssembly: add basic int/fp instruction codegen.
Summary: This patch has the most basic instruction codegen for 32 and 64 bit int/fp. Reviewers: sunfish Subscribers: llvm-commits, jfb Differential Revision: http://reviews.llvm.org/D11193 llvm-svn: 242201
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
index 80cede0c8ca..513c36fa2ec 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
@@ -27,3 +27,29 @@ class I<dag oops, dag iops, list<dag> pattern, string cstr = "">
dag InOperandList = iops;
let Pattern = pattern;
}
+
+// Unary and binary instructions, for the local types that WebAssembly supports.
+multiclass UnaryInt<SDNode node> {
+ def _I32 : I<(outs Int32:$dst), (ins Int32:$src),
+ [(set Int32:$dst, (node Int32:$src))]>;
+ def _I64 : I<(outs Int64:$dst), (ins Int64:$src),
+ [(set Int64:$dst, (node Int64:$src))]>;
+}
+multiclass BinaryInt<SDNode node> {
+ def _I32 : I<(outs Int32:$dst), (ins Int32:$lhs, Int32:$rhs),
+ [(set Int32:$dst, (node Int32:$lhs, Int32:$rhs))]>;
+ def _I64 : I<(outs Int64:$dst), (ins Int64:$lhs, Int64:$rhs),
+ [(set Int64:$dst, (node Int64:$lhs, Int64:$rhs))]>;
+}
+multiclass UnaryFP<SDNode node> {
+ def _F32 : I<(outs Float32:$dst), (ins Float32:$src),
+ [(set Float32:$dst, (node Float32:$src))]>;
+ def _F64 : I<(outs Float64:$dst), (ins Float64:$src),
+ [(set Float64:$dst, (node Float64:$src))]>;
+}
+multiclass BinaryFP<SDNode node> {
+ def _F32 : I<(outs Float32:$dst), (ins Float32:$lhs, Float32:$rhs),
+ [(set Float32:$dst, (node Float32:$lhs, Float32:$rhs))]>;
+ def _F64 : I<(outs Float64:$dst), (ins Float64:$lhs, Float64:$rhs),
+ [(set Float64:$dst, (node Float64:$lhs, Float64:$rhs))]>;
+}
OpenPOWER on IntegriCloud