diff options
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/i64.ll')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/i64.ll | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/i64.ll b/llvm/test/CodeGen/WebAssembly/i64.ll index c2a1bb6b970..85a8ae34dcb 100644 --- a/llvm/test/CodeGen/WebAssembly/i64.ll +++ b/llvm/test/CodeGen/WebAssembly/i64.ll @@ -199,3 +199,57 @@ define i32 @eqz64(i64 %x) { %b = zext i1 %a to i32 ret i32 %b } + +; CHECK-LABEL: rotl: +; CHECK-NEXT: .param i64, i64{{$}} +; CHECK-NEXT: .result i64{{$}} +; CHECK-NEXT: i64.rotl $push0=, $0, $1 +; CHECK-NEXT: return $pop0{{$}} +define i64 @rotl(i64 %x, i64 %y) { + %z = sub i64 64, %y + %b = shl i64 %x, %y + %c = lshr i64 %x, %z + %d = or i64 %b, %c + ret i64 %d +} + +; CHECK-LABEL: masked_rotl: +; CHECK-NEXT: .param i64, i64{{$}} +; CHECK-NEXT: .result i64{{$}} +; CHECK-NEXT: i64.rotl $push0=, $0, $1 +; CHECK-NEXT: return $pop0{{$}} +define i64 @masked_rotl(i64 %x, i64 %y) { + %a = and i64 %y, 63 + %z = sub i64 64, %a + %b = shl i64 %x, %a + %c = lshr i64 %x, %z + %d = or i64 %b, %c + ret i64 %d +} + +; CHECK-LABEL: rotr: +; CHECK-NEXT: .param i64, i64{{$}} +; CHECK-NEXT: .result i64{{$}} +; CHECK-NEXT: i64.rotr $push0=, $0, $1 +; CHECK-NEXT: return $pop0{{$}} +define i64 @rotr(i64 %x, i64 %y) { + %z = sub i64 64, %y + %b = lshr i64 %x, %y + %c = shl i64 %x, %z + %d = or i64 %b, %c + ret i64 %d +} + +; CHECK-LABEL: masked_rotr: +; CHECK-NEXT: .param i64, i64{{$}} +; CHECK-NEXT: .result i64{{$}} +; CHECK-NEXT: i64.rotr $push0=, $0, $1 +; CHECK-NEXT: return $pop0{{$}} +define i64 @masked_rotr(i64 %x, i64 %y) { + %a = and i64 %y, 63 + %z = sub i64 64, %a + %b = lshr i64 %x, %a + %c = shl i64 %x, %z + %d = or i64 %b, %c + ret i64 %d +} |