diff options
author | Dan Gohman <dan433584@gmail.com> | 2016-03-22 18:01:49 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2016-03-22 18:01:49 +0000 |
commit | 665d7e38380057fd2893db4573f6165bcb8b23be (patch) | |
tree | 79e6e573aa7a300b54461cd2d123b54e9fafe1be /llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td | |
parent | 4c3b55cfce02a263ad8ee2b71b21472f14712847 (diff) | |
download | bcm5719-llvm-665d7e38380057fd2893db4573f6165bcb8b23be.tar.gz bcm5719-llvm-665d7e38380057fd2893db4573f6165bcb8b23be.zip |
[WebAssembly] Implement the rotate instructions.
llvm-svn: 264076
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td index f5404ec8c8a..a597ac950a8 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInteger.td @@ -36,6 +36,8 @@ defm XOR : BinaryInt<xor, "xor ">; defm SHL : BinaryInt<shl, "shl ">; defm SHR_U : BinaryInt<srl, "shr_u">; defm SHR_S : BinaryInt<sra, "shr_s">; +defm ROTL : BinaryInt<rotl, "rotl">; +defm ROTR : BinaryInt<rotr, "rotr">; let isCommutable = 1 in { defm EQ : ComparisonInt<SETEQ, "eq ">; @@ -69,6 +71,12 @@ 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)>; +// Optimize away an explicit mask on a rotate count. +def : Pat<(rotl I32:$lhs, (and I32:$rhs, 31)), (ROTL_I32 I32:$lhs, I32:$rhs)>; +def : Pat<(rotr I32:$lhs, (and I32:$rhs, 31)), (ROTR_I32 I32:$lhs, I32:$rhs)>; +def : Pat<(rotl I64:$lhs, (and I64:$rhs, 63)), (ROTL_I64 I64:$lhs, I64:$rhs)>; +def : Pat<(rotr I64:$lhs, (and I64:$rhs, 63)), (ROTR_I64 I64:$lhs, I64:$rhs)>; + let Defs = [ARGUMENTS] in { def SELECT_I32 : I<(outs I32:$dst), (ins I32:$lhs, I32:$rhs, I32:$cond), |