1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri < %s | FileCheck %s 2 3 ; CHECK: 'addrspacecast_global_to_flat' 4 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast i8 addrspace(1)* %ptr to i8 addrspace(4)* 5 define i8 addrspace(4)* @addrspacecast_global_to_flat(i8 addrspace(1)* %ptr) #0 { 6 %cast = addrspacecast i8 addrspace(1)* %ptr to i8 addrspace(4)* 7 ret i8 addrspace(4)* %cast 8 } 9 10 ; CHECK: 'addrspacecast_global_to_flat_v2' 11 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <2 x i8 addrspace(1)*> %ptr to <2 x i8 addrspace(4)*> 12 define <2 x i8 addrspace(4)*> @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 addrspace(4)*> 14 ret <2 x i8 addrspace(4)*> %cast 15 } 16 17 ; CHECK: 'addrspacecast_global_to_flat_v32' 18 ; CHECK: estimated cost of 0 for {{.*}} addrspacecast <32 x i8 addrspace(1)*> %ptr to <32 x i8 addrspace(4)*> 19 define <32 x i8 addrspace(4)*> @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 addrspace(4)*> 21 ret <32 x i8 addrspace(4)*> %cast 22 } 23 24 ; CHECK: 'addrspacecast_local_to_flat' 25 ; CHECK: estimated cost of 1 for {{.*}} addrspacecast i8 addrspace(3)* %ptr to i8 addrspace(4)* 26 define i8 addrspace(4)* @addrspacecast_local_to_flat(i8 addrspace(3)* %ptr) #0 { 27 %cast = addrspacecast i8 addrspace(3)* %ptr to i8 addrspace(4)* 28 ret i8 addrspace(4)* %cast 29 } 30 31 ; CHECK: 'addrspacecast_local_to_flat_v2' 32 ; CHECK: estimated cost of 2 for {{.*}} addrspacecast <2 x i8 addrspace(3)*> %ptr to <2 x i8 addrspace(4)*> 33 define <2 x i8 addrspace(4)*> @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 addrspace(4)*> 35 ret <2 x i8 addrspace(4)*> %cast 36 } 37 38 ; CHECK: 'addrspacecast_local_to_flat_v32' 39 ; CHECK: estimated cost of 32 for {{.*}} addrspacecast <32 x i8 addrspace(3)*> %ptr to <32 x i8 addrspace(4)*> 40 define <32 x i8 addrspace(4)*> @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 addrspace(4)*> 42 ret <32 x i8 addrspace(4)*> %cast 43 } 44 45 attributes #0 = { nounwind readnone } 46