1 ; RUN: not llc -march=amdgcn -mtriple=amdgcn-mesa-mesa3d -tailcallopt < %s 2>&1 | FileCheck --check-prefix=GCN %s
2 ; RUN: not llc -march=amdgcn -mtriple=amdgcn--amdpal -tailcallopt < %s 2>&1 | FileCheck --check-prefix=GCN %s
3 ; RUN: not llc -march=r600 -mtriple=r600-- -mcpu=cypress -tailcallopt < %s 2>&1 | FileCheck -check-prefix=R600 %s
5 declare i32 @external_function(i32) nounwind
8 ; R600: in function test_call_external{{.*}}: unsupported call to function external_function
9 define amdgpu_kernel void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
10 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
11 %a = load i32, i32 addrspace(1)* %in
12 %b = load i32, i32 addrspace(1)* %b_ptr
13 %c = call i32 @external_function(i32 %b) nounwind
14 %result = add i32 %a, %c
15 store i32 %result, i32 addrspace(1)* %out
19 define i32 @defined_function(i32 %x) nounwind noinline {
25 ; R600: in function test_call{{.*}}: unsupported call to function defined_function
26 define amdgpu_kernel void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
27 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
28 %a = load i32, i32 addrspace(1)* %in
29 %b = load i32, i32 addrspace(1)* %b_ptr
30 %c = call i32 @defined_function(i32 %b) nounwind
31 %result = add i32 %a, %c
32 store i32 %result, i32 addrspace(1)* %out
36 ; 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
37 ; R600: in function test_tail_call{{.*}}: unsupported call to function defined_function
38 define i32 @test_tail_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
39 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
40 %a = load i32, i32 addrspace(1)* %in
41 %b = load i32, i32 addrspace(1)* %b_ptr
42 %c = tail call i32 @defined_function(i32 %b)
46 declare void @external.varargs(i32, double, i64, ...)
48 ; GCN: error: <unknown>:0:0: in function test_call_varargs void (): unsupported call to variadic function external.varargs
49 ; R600: in function test_call_varargs{{.*}}: unsupported call to function external.varargs
50 define void @test_call_varargs() {
51 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)
55 declare i32 @extern_variadic(...)
57 ; GCN: in function test_tail_call_bitcast_extern_variadic{{.*}}: unsupported call to variadic function extern_variadic
58 ; R600: in function test_tail_call_bitcast_extern_variadic{{.*}}: unsupported call to function extern_variadic
59 define i32 @test_tail_call_bitcast_extern_variadic(<4 x float> %arg0, <4 x float> %arg1, i32 %arg2) {
60 %add = fadd <4 x float> %arg0, %arg1
61 %call = tail call i32 bitcast (i32 (...)* @extern_variadic to i32 (<4 x float>)*)(<4 x float> %add)
65 ; GCN: :0:0: in function test_c_call_from_shader i32 (): unsupported calling convention for call from graphics shader of function defined_function
66 ; R600: in function test_c_call{{.*}}: unsupported call to function defined_function
67 define amdgpu_ps i32 @test_c_call_from_shader() {
68 %call = call i32 @defined_function(i32 0)
72 ; GCN-NOT: in function test_gfx_call{{.*}}unsupported
73 ; R600: in function test_gfx_call{{.*}}: unsupported call to function defined_function
74 define amdgpu_ps i32 @test_gfx_call_from_shader() {
75 %call = call amdgpu_gfx i32 @defined_function(i32 0)