1448f04ab91f0723a51667968f6e1709d27fe748
[oota-llvm.git] / test / CodeGen / R600 / call.ll
1 ; RUN: not llc -march=r600 -mcpu=SI -verify-machineinstrs< %s 2>&1 | FileCheck %s
2 ; RUN: not llc -march=r600 -mcpu=cypress < %s 2>&1 | FileCheck %s
3
4 ; CHECK: error: unsupported call to function external_function in test_call_external
5
6
7 declare i32 @external_function(i32) nounwind
8
9 define i32 @defined_function(i32 %x) nounwind noinline {
10   %y = add i32 %x, 8
11   ret i32 %y
12 }
13
14 define void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
15   %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
16   %a = load i32 addrspace(1)* %in
17   %b = load i32 addrspace(1)* %b_ptr
18   %c = call i32 @defined_function(i32 %b) nounwind
19   %result = add i32 %a, %c
20   store i32 %result, i32 addrspace(1)* %out
21   ret void
22 }
23
24 define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
25   %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
26   %a = load i32 addrspace(1)* %in
27   %b = load i32 addrspace(1)* %b_ptr
28   %c = call i32 @external_function(i32 %b) nounwind
29   %result = add i32 %a, %c
30   store i32 %result, i32 addrspace(1)* %out
31   ret void
32 }
33