1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri < %s | FileCheck %s
3 ; CHECK-LABEL: 'addrspacecast_global_to_flat'
4 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast i8 addrspace(1)* %ptr to i8*
5 define i8* @addrspacecast_global_to_flat(i8 addrspace(1)* %ptr) #0 {
6 %cast = addrspacecast i8 addrspace(1)* %ptr to i8*
10 ; CHECK-LABEL: 'addrspacecast_global_to_flat_v2'
11 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <2 x i8 addrspace(1)*> %ptr to <2 x i8*>
12 define <2 x i8*> @addrspacecast_global_to_flat_v2(<2 x i8 addrspace(1)*> %ptr) #0 {
13 %cast = addrspacecast <2 x i8 addrspace(1)*> %ptr to <2 x i8*>
17 ; CHECK-LABEL: 'addrspacecast_global_to_flat_v32'
18 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <32 x i8 addrspace(1)*> %ptr to <32 x i8*>
19 define <32 x i8*> @addrspacecast_global_to_flat_v32(<32 x i8 addrspace(1)*> %ptr) #0 {
20 %cast = addrspacecast <32 x i8 addrspace(1)*> %ptr to <32 x i8*>
24 ; CHECK-LABEL: 'addrspacecast_local_to_flat'
25 ; CHECK: estimated cost of 1 for {{.*}} addrspacecast i8 addrspace(3)* %ptr to i8*
26 define i8* @addrspacecast_local_to_flat(i8 addrspace(3)* %ptr) #0 {
27 %cast = addrspacecast i8 addrspace(3)* %ptr to i8*
31 ; CHECK-LABEL: 'addrspacecast_local_to_flat_v2'
32 ; CHECK: estimated cost of 2 for {{.*}} addrspacecast <2 x i8 addrspace(3)*> %ptr to <2 x i8*>
33 define <2 x i8*> @addrspacecast_local_to_flat_v2(<2 x i8 addrspace(3)*> %ptr) #0 {
34 %cast = addrspacecast <2 x i8 addrspace(3)*> %ptr to <2 x i8*>
38 ; CHECK-LABEL: 'addrspacecast_local_to_flat_v32'
39 ; CHECK: estimated cost of 32 for {{.*}} addrspacecast <32 x i8 addrspace(3)*> %ptr to <32 x i8*>
40 define <32 x i8*> @addrspacecast_local_to_flat_v32(<32 x i8 addrspace(3)*> %ptr) #0 {
41 %cast = addrspacecast <32 x i8 addrspace(3)*> %ptr to <32 x i8*>
45 ; CHECK-LABEL: 'addrspacecast_flat_to_local'
46 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast i8* %ptr to i8 addrspace(3)*
47 define i8 addrspace(3)* @addrspacecast_flat_to_local(i8* %ptr) #0 {
48 %cast = addrspacecast i8* %ptr to i8 addrspace(3)*
49 ret i8 addrspace(3)* %cast
52 ; CHECK-LABEL: 'addrspacecast_flat_to_local_v2'
53 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <2 x i8*> %ptr to <2 x i8 addrspace(3)*>
54 define <2 x i8 addrspace(3)*> @addrspacecast_flat_to_local_v2(<2 x i8*> %ptr) #0 {
55 %cast = addrspacecast <2 x i8*> %ptr to <2 x i8 addrspace(3)*>
56 ret <2 x i8 addrspace(3)*> %cast
59 ; CHECK-LABEL: 'addrspacecast_flat_to_local_v32'
60 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <32 x i8*> %ptr to <32 x i8 addrspace(3)*>
61 define <32 x i8 addrspace(3)*> @addrspacecast_flat_to_local_v32(<32 x i8*> %ptr) #0 {
62 %cast = addrspacecast <32 x i8*> %ptr to <32 x i8 addrspace(3)*>
63 ret <32 x i8 addrspace(3)*> %cast
66 attributes #0 = { nounwind readnone }