Matt Arsenault | 9430b91 | 2016-05-18 16:10:11 +0000 | [diff] [blame^] | 1 | ; RUN: not llc -march=amdgcn -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 |
Matt Arsenault | 1635387 | 2014-04-22 16:42:00 +0000 | [diff] [blame] | 4 | |
Oliver Stannard | 7e7d983 | 2016-02-02 13:52:43 +0000 | [diff] [blame] | 5 | ; CHECK: in function test_call_external{{.*}}: unsupported call to function external_function |
Matt Arsenault | 9430b91 | 2016-05-18 16:10:11 +0000 | [diff] [blame^] | 6 | ; CHECK: in function test_call{{.*}}: unsupported call to function defined_function |
| 7 | ; CHECK: in function test_tail_call{{.*}}: unsupported call to function defined_function |
Matt Arsenault | 1635387 | 2014-04-22 16:42:00 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | declare i32 @external_function(i32) nounwind |
| 11 | |
Matt Arsenault | deaef8e | 2015-04-22 17:10:44 +0000 | [diff] [blame] | 12 | define void @test_call_external(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { |
| 13 | %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 |
| 14 | %a = load i32, i32 addrspace(1)* %in |
| 15 | %b = load i32, i32 addrspace(1)* %b_ptr |
| 16 | %c = call i32 @external_function(i32 %b) nounwind |
| 17 | %result = add i32 %a, %c |
| 18 | store i32 %result, i32 addrspace(1)* %out |
| 19 | ret void |
| 20 | } |
| 21 | |
Matt Arsenault | 1635387 | 2014-04-22 16:42:00 +0000 | [diff] [blame] | 22 | define i32 @defined_function(i32 %x) nounwind noinline { |
| 23 | %y = add i32 %x, 8 |
| 24 | ret i32 %y |
| 25 | } |
| 26 | |
| 27 | define void @test_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 28 | %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 29 | %a = load i32, i32 addrspace(1)* %in |
| 30 | %b = load i32, i32 addrspace(1)* %b_ptr |
Matt Arsenault | 1635387 | 2014-04-22 16:42:00 +0000 | [diff] [blame] | 31 | %c = call i32 @defined_function(i32 %b) nounwind |
| 32 | %result = add i32 %a, %c |
| 33 | store i32 %result, i32 addrspace(1)* %out |
| 34 | ret void |
| 35 | } |
Matt Arsenault | 9430b91 | 2016-05-18 16:10:11 +0000 | [diff] [blame^] | 36 | |
| 37 | define void @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) nounwind |
| 42 | %result = add i32 %a, %c |
| 43 | store i32 %result, i32 addrspace(1)* %out |
| 44 | ret void |
| 45 | } |