1; RUN: not llc -march=amdgcn -mtriple=amdgcn---amdgiz -tailcallopt < %s 2>&1 | FileCheck -check-prefix=GCN %s 2; RUN: not llc -march=r600 -mtriple=r600---amdgiz -mcpu=cypress -tailcallopt < %s 2>&1 | FileCheck -check-prefix=R600 %s 3 4declare i32 @external_function(i32) nounwind 5 6; GCN-NOT: error 7; R600: in function test_call_external{{.*}}: unsupported call to function external_function 8define amdgpu_kernel void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { 9 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 10 %a = load i32, i32 addrspace(1)* %in 11 %b = load i32, i32 addrspace(1)* %b_ptr 12 %c = call i32 @external_function(i32 %b) nounwind 13 %result = add i32 %a, %c 14 store i32 %result, i32 addrspace(1)* %out 15 ret void 16} 17 18define i32 @defined_function(i32 %x) nounwind noinline { 19 %y = add i32 %x, 8 20 ret i32 %y 21} 22 23; GCN-NOT: error 24; R600: in function test_call{{.*}}: unsupported call to function defined_function 25define amdgpu_kernel void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { 26 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 27 %a = load i32, i32 addrspace(1)* %in 28 %b = load i32, i32 addrspace(1)* %b_ptr 29 %c = call i32 @defined_function(i32 %b) nounwind 30 %result = add i32 %a, %c 31 store i32 %result, i32 addrspace(1)* %out 32 ret void 33} 34 35; GCN: error: <unknown>:0:0: in function test_tail_call i32 (i32 addrspace(1)*, i32 addrspace(1)*): unsupported required tail call to function defined_function 36; R600: in function test_tail_call{{.*}}: unsupported call to function defined_function 37define i32 @test_tail_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { 38 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 39 %a = load i32, i32 addrspace(1)* %in 40 %b = load i32, i32 addrspace(1)* %b_ptr 41 %c = tail call i32 @defined_function(i32 %b) 42 ret i32 %c 43} 44 45declare void @external.varargs(i32, double, i64, ...) 46 47; GCN: error: <unknown>:0:0: in function test_call_varargs void (): unsupported call to variadic function external.varargs 48; R600: in function test_call_varargs{{.*}}: unsupported call to function external.varargs 49define void @test_call_varargs() { 50 call void (i32, double, i64, ...) @external.varargs(i32 42, double 1.0, i64 12, i8 3, i16 1, i32 4, float 1.0, double 2.0) 51 ret void 52} 53 54declare i32 @extern_variadic(...) 55 56; GCN: in function test_tail_call_bitcast_extern_variadic{{.*}}: unsupported indirect call to function extern_variadic 57; R600: in function test_tail_call_bitcast_extern_variadic{{.*}}: unsupported call to function extern_variadic 58define i32 @test_tail_call_bitcast_extern_variadic(<4 x float> %arg0, <4 x float> %arg1, i32 %arg2) { 59 %add = fadd <4 x float> %arg0, %arg1 60 %call = tail call i32 bitcast (i32 (...)* @extern_variadic to i32 (<4 x float>)*)(<4 x float> %add) 61 ret i32 %call 62} 63 64; GCN: :0:0: in function test_indirect_call void (void ()*): unsupported indirect call to function <unknown> 65; R600: in function test_indirect_call{{.*}}: unsupported call to function <unknown> 66define void @test_indirect_call(void()* %fptr) { 67 call void %fptr() 68 ret void 69} 70 71; GCN: :0:0: in function test_call_from_shader i32 (): unsupported call from graphics shader of function defined_function 72; R600: in function test_call{{.*}}: unsupported call to function defined_function 73define amdgpu_ps i32 @test_call_from_shader() { 74 %call = call i32 @defined_function(i32 0) 75 ret i32 %call 76} 77