1; RUN: not llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s 2>&1 | FileCheck %s
2; RUN: not llc -march=amdgcn -mcpu=tonga -verify-machineinstrs< %s 2>&1 | FileCheck %s
3; RUN: not llc -march=r600 -mcpu=cypress < %s 2>&1 | FileCheck %s
4
5; CHECK: error: unsupported call to function external_function in test_call_external
6
7
8declare i32 @external_function(i32) nounwind
9
10define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
11  %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
12  %a = load i32 addrspace(1)* %in
13  %b = load i32 addrspace(1)* %b_ptr
14  %c = call i32 @external_function(i32 %b) nounwind
15  %result = add i32 %a, %c
16  store i32 %result, i32 addrspace(1)* %out
17  ret void
18}
19
20define i32 @defined_function(i32 %x) nounwind noinline {
21  %y = add i32 %x, 8
22  ret i32 %y
23}
24
25define void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
26  %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
27  %a = load i32 addrspace(1)* %in
28  %b = load 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