diff options
| author | Derek Schuff <dschuff@google.com> | 2015-11-03 22:40:40 +0000 |
|---|---|---|
| committer | Derek Schuff <dschuff@google.com> | 2015-11-03 22:40:40 +0000 |
| commit | 6b5c6da7603a6ddab37d93828b20141cd410c3da (patch) | |
| tree | 4962600ebdef32b29a271eccd3663cbbb5c4e63e /llvm/lib | |
| parent | 0644900004343cd0eb094eba97a3f2edf61a1cd5 (diff) | |
| download | bcm5719-llvm-6b5c6da7603a6ddab37d93828b20141cd410c3da.tar.gz bcm5719-llvm-6b5c6da7603a6ddab37d93828b20141cd410c3da.zip | |
[WebAssembly] Support wasm select operator
Summary:
Add support for wasm's select operator, and lower LLVM's select DAG node
to it.
Reviewers: sunfish
Subscribers: dschuff, llvm-commits, jfb
Differential Revision: http://reviews.llvm.org/D14295
llvm-svn: 252002
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td | 5 | ||||
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td index 456b2f69eb1..7f342c353e1 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td @@ -58,3 +58,8 @@ def : Pat<(setge f64:$lhs, f64:$rhs), (GE_F64 f64:$lhs, f64:$rhs)>; * f32.min: minimum (binary operator); if either operand is NaN, returns NaN * f32.max: maximum (binary operator); if either operand is NaN, returns NaN */ + +def SELECT_F32 : I<(outs F32:$dst), (ins I32:$cond, F32:$lhs, F32:$rhs), + [(set F32:$dst, (select I32:$cond, F32:$lhs, F32:$rhs))]>; +def SELECT_F64 : I<(outs F64:$dst), (ins I32:$cond, F64:$lhs, F64:$rhs), + [(set F64:$dst, (select I32:$cond, F64:$lhs, F64:$rhs))]>; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td index 6a28a13eb3b..ad036017e81 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td @@ -46,3 +46,8 @@ def : Pat<(ctlz_zero_undef I32:$src), (CLZ_I32 I32:$src)>; def : Pat<(ctlz_zero_undef I64:$src), (CLZ_I64 I64:$src)>; def : Pat<(cttz_zero_undef I32:$src), (CTZ_I32 I32:$src)>; def : Pat<(cttz_zero_undef I64:$src), (CTZ_I64 I64:$src)>; + +def SELECT_I32 : I<(outs I32:$dst), (ins I32:$cond, I32:$lhs, I32:$rhs), + [(set I32:$dst, (select I32:$cond, I32:$lhs, I32:$rhs))]>; +def SELECT_I64 : I<(outs I64:$dst), (ins I32:$cond, I64:$lhs, I64:$rhs), + [(set I64:$dst, (select I32:$cond, I64:$lhs, I64:$rhs))]>; |

