1; RUN: not llc -mtriple=amdgcn-mesa-mesa3d -tailcallopt -verify-machineinstrs=0 < %s 2>&1 | FileCheck --check-prefix=GCN %s 2; RUN: not llc -mtriple=amdgcn--amdpal -tailcallopt -verify-machineinstrs=0 < %s 2>&1 | FileCheck --check-prefix=GCN %s 3; RUN: not llc -mtriple=r600-- -mcpu=cypress -tailcallopt < %s 2>&1 | FileCheck -check-prefix=R600 %s 4 5declare i32 @external_function(i32) nounwind 6 7; GCN-NOT: error 8; R600: in function test_call_external{{.*}}: unsupported call to function external_function 9define amdgpu_kernel void @test_call_external(ptr addrspace(1) %out, ptr addrspace(1) %in) { 10 %b_ptr = getelementptr i32, ptr addrspace(1) %in, i32 1 11 %a = load i32, ptr addrspace(1) %in 12 %b = load i32, ptr addrspace(1) %b_ptr 13 %c = call i32 @external_function(i32 %b) nounwind 14 %result = add i32 %a, %c 15 store i32 %result, ptr addrspace(1) %out 16 ret void 17} 18 19define i32 @defined_function(i32 %x) nounwind noinline { 20 %y = add i32 %x, 8 21 ret i32 %y 22} 23 24; GCN-NOT: error 25; R600: in function test_call{{.*}}: unsupported call to function defined_function 26define amdgpu_kernel void @test_call(ptr addrspace(1) %out, ptr addrspace(1) %in) { 27 %b_ptr = getelementptr i32, ptr addrspace(1) %in, i32 1 28 %a = load i32, ptr addrspace(1) %in 29 %b = load i32, ptr addrspace(1) %b_ptr 30 %c = call i32 @defined_function(i32 %b) nounwind 31 %result = add i32 %a, %c 32 store i32 %result, ptr addrspace(1) %out 33 ret void 34} 35 36; GCN: error: <unknown>:0:0: in function test_tail_call i32 (ptr addrspace(1), ptr addrspace(1)): unsupported required tail call to function defined_function 37; R600: in function test_tail_call{{.*}}: unsupported call to function defined_function 38define i32 @test_tail_call(ptr addrspace(1) %out, ptr addrspace(1) %in) { 39 %b_ptr = getelementptr i32, ptr addrspace(1) %in, i32 1 40 %a = load i32, ptr addrspace(1) %in 41 %b = load i32, ptr addrspace(1) %b_ptr 42 %c = tail call i32 @defined_function(i32 %b) 43 ret i32 %c 44} 45 46; R600: in function test_c_call{{.*}}: unsupported call to function defined_function 47define amdgpu_ps i32 @test_c_call_from_shader() { 48 %call = call i32 @defined_function(i32 0) 49 ret i32 %call 50} 51 52; GCN-NOT: in function test_gfx_call{{.*}}unsupported 53; R600: in function test_gfx_call{{.*}}: unsupported call to function defined_function 54define amdgpu_ps i32 @test_gfx_call_from_shader() { 55 %call = call amdgpu_gfx i32 @defined_function(i32 0) 56 ret i32 %call 57} 58 59