1; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=+half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=FAST64 %s
2; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=SLOW64 %s
3
4; ALL: 'shl_i32'
5; ALL: estimated cost of 1 for {{.*}} shl i32
6define void @shl_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
7  %vec = load i32, i32 addrspace(1)* %vaddr
8  %or = shl i32 %vec, %b
9  store i32 %or, i32 addrspace(1)* %out
10  ret void
11}
12
13; ALL: 'shl_i64'
14; FAST64: estimated cost of 2 for {{.*}} shl i64
15; SLOW64: estimated cost of 3 for {{.*}} shl i64
16define void @shl_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %vaddr, i64 %b) #0 {
17  %vec = load i64, i64 addrspace(1)* %vaddr
18  %or = shl i64 %vec, %b
19  store i64 %or, i64 addrspace(1)* %out
20  ret void
21}
22
23; ALL: 'lshr_i32'
24; ALL: estimated cost of 1 for {{.*}} lshr i32
25define void @lshr_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
26  %vec = load i32, i32 addrspace(1)* %vaddr
27  %or = lshr i32 %vec, %b
28  store i32 %or, i32 addrspace(1)* %out
29  ret void
30}
31
32; ALL: 'lshr_i64'
33; FAST64: estimated cost of 2 for {{.*}} lshr i64
34; SLOW64: estimated cost of 3 for {{.*}} lshr i64
35define void @lshr_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %vaddr, i64 %b) #0 {
36  %vec = load i64, i64 addrspace(1)* %vaddr
37  %or = lshr i64 %vec, %b
38  store i64 %or, i64 addrspace(1)* %out
39  ret void
40}
41
42; ALL: 'ashr_i32'
43; ALL: estimated cost of 1 for {{.*}} ashr i32
44define void @ashr_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
45  %vec = load i32, i32 addrspace(1)* %vaddr
46  %or = ashr i32 %vec, %b
47  store i32 %or, i32 addrspace(1)* %out
48  ret void
49}
50
51; ALL: 'ashr_i64'
52; FAST64: estimated cost of 2 for {{.*}} ashr i64
53; SLOW64: estimated cost of 3 for {{.*}} ashr i64
54define void @ashr_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %vaddr, i64 %b) #0 {
55  %vec = load i64, i64 addrspace(1)* %vaddr
56  %or = ashr i64 %vec, %b
57  store i64 %or, i64 addrspace(1)* %out
58  ret void
59}
60
61attributes #0 = { nounwind }
62