blob: 586de44a566ccdf74b6099450e8e983c2f9b1689 [file] [log] [blame]
Marek Olsak707a6d02015-02-03 21:53:01 +00001; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=BOTH %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=BOTH %s
Matt Arsenaultf302c942014-06-15 21:09:00 +00003
Marek Olsak707a6d02015-02-03 21:53:01 +00004; BOTH-LABEL: {{^}}s_rotr_i64:
5; BOTH-DAG: s_sub_i32
6; BOTH-DAG: s_lshr_b64
7; BOTH-DAG: s_lshl_b64
8; BOTH: s_or_b64
Matt Arsenaultf302c942014-06-15 21:09:00 +00009define void @s_rotr_i64(i64 addrspace(1)* %in, i64 %x, i64 %y) {
10entry:
11 %tmp0 = sub i64 64, %y
12 %tmp1 = shl i64 %x, %tmp0
13 %tmp2 = lshr i64 %x, %y
14 %tmp3 = or i64 %tmp1, %tmp2
15 store i64 %tmp3, i64 addrspace(1)* %in
16 ret void
17}
18
Marek Olsak707a6d02015-02-03 21:53:01 +000019; BOTH-LABEL: {{^}}v_rotr_i64:
20; BOTH-DAG: v_sub_i32
Tom Stellard326d6ec2014-11-05 14:50:53 +000021; SI-DAG: v_lshr_b64
22; SI-DAG: v_lshl_b64
Marek Olsak707a6d02015-02-03 21:53:01 +000023; VI-DAG: v_lshrrev_b64
24; VI-DAG: v_lshlrev_b64
25; BOTH: v_or_b32
26; BOTH: v_or_b32
Matt Arsenaultf302c942014-06-15 21:09:00 +000027define void @v_rotr_i64(i64 addrspace(1)* %in, i64 addrspace(1)* %xptr, i64 addrspace(1)* %yptr) {
28entry:
David Blaikiea79ac142015-02-27 21:17:42 +000029 %x = load i64, i64 addrspace(1)* %xptr, align 8
30 %y = load i64, i64 addrspace(1)* %yptr, align 8
Matt Arsenaultf302c942014-06-15 21:09:00 +000031 %tmp0 = sub i64 64, %y
32 %tmp1 = shl i64 %x, %tmp0
33 %tmp2 = lshr i64 %x, %y
34 %tmp3 = or i64 %tmp1, %tmp2
35 store i64 %tmp3, i64 addrspace(1)* %in
36 ret void
37}
38
Marek Olsak707a6d02015-02-03 21:53:01 +000039; BOTH-LABEL: {{^}}s_rotr_v2i64:
Matt Arsenaultf302c942014-06-15 21:09:00 +000040define void @s_rotr_v2i64(<2 x i64> addrspace(1)* %in, <2 x i64> %x, <2 x i64> %y) {
41entry:
42 %tmp0 = sub <2 x i64> <i64 64, i64 64>, %y
43 %tmp1 = shl <2 x i64> %x, %tmp0
44 %tmp2 = lshr <2 x i64> %x, %y
45 %tmp3 = or <2 x i64> %tmp1, %tmp2
46 store <2 x i64> %tmp3, <2 x i64> addrspace(1)* %in
47 ret void
48}
49
Marek Olsak707a6d02015-02-03 21:53:01 +000050; BOTH-LABEL: {{^}}v_rotr_v2i64:
Matt Arsenaultf302c942014-06-15 21:09:00 +000051define void @v_rotr_v2i64(<2 x i64> addrspace(1)* %in, <2 x i64> addrspace(1)* %xptr, <2 x i64> addrspace(1)* %yptr) {
52entry:
David Blaikiea79ac142015-02-27 21:17:42 +000053 %x = load <2 x i64>, <2 x i64> addrspace(1)* %xptr, align 8
54 %y = load <2 x i64>, <2 x i64> addrspace(1)* %yptr, align 8
Matt Arsenaultf302c942014-06-15 21:09:00 +000055 %tmp0 = sub <2 x i64> <i64 64, i64 64>, %y
56 %tmp1 = shl <2 x i64> %x, %tmp0
57 %tmp2 = lshr <2 x i64> %x, %y
58 %tmp3 = or <2 x i64> %tmp1, %tmp2
59 store <2 x i64> %tmp3, <2 x i64> addrspace(1)* %in
60 ret void
61}