xref: /llvm-project/llvm/test/CodeGen/WebAssembly/rotate-i3264.ll (revision 9571a28ee4e801a7796569d62fe037fc22cd65a4)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2; RUN: sed 's/iX/i32/g' %s | llc --mtriple=wasm32-unknown-unknown | FileCheck --check-prefix=I32 %s
3; RUN: sed 's/iX/i64/g' %s | llc --mtriple=wasm64-unknown-unknown | FileCheck --check-prefix=I64 %s
4
5declare iX @llvm.fshl.iX(iX, iX, iX)
6declare iX @llvm.fshr.iX(iX, iX, iX)
7
8; from https://github.com/llvm/llvm-project/issues/62703
9
10define iX @testLeft(iX noundef %0, iX noundef %1) {
11; I32-LABEL: testLeft:
12; I32:         .functype testLeft (i32, i32) -> (i32)
13; I32-NEXT:  # %bb.0:
14; I32-NEXT:    local.get 0
15; I32-NEXT:    local.get 1
16; I32-NEXT:    i32.rotl
17; I32-NEXT:    # fallthrough-return
18;
19; I64-LABEL: testLeft:
20; I64:         .functype testLeft (i64, i64) -> (i64)
21; I64-NEXT:  # %bb.0:
22; I64-NEXT:    local.get 0
23; I64-NEXT:    local.get 1
24; I64-NEXT:    i64.rotl
25; I64-NEXT:    # fallthrough-return
26  %3 = call iX @llvm.fshl.iX(iX %0, iX %0, iX %1)
27  ret iX %3
28}
29
30define iX @testRight(iX noundef %0, iX noundef %1) {
31; I32-LABEL: testRight:
32; I32:         .functype testRight (i32, i32) -> (i32)
33; I32-NEXT:  # %bb.0:
34; I32-NEXT:    local.get 0
35; I32-NEXT:    local.get 1
36; I32-NEXT:    i32.rotr
37; I32-NEXT:    # fallthrough-return
38;
39; I64-LABEL: testRight:
40; I64:         .functype testRight (i64, i64) -> (i64)
41; I64-NEXT:  # %bb.0:
42; I64-NEXT:    local.get 0
43; I64-NEXT:    local.get 1
44; I64-NEXT:    i64.rotr
45; I64-NEXT:    # fallthrough-return
46  %3 = call iX @llvm.fshr.iX(iX %0, iX %0, iX %1)
47  ret iX %3
48}
49