xref: /llvm-project/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll (revision 728490257ecc09ada707a0390303bd3c61027a53)
1; RUN: llc -mtriple=sparc -O0 <%s
2; RUN: llc -mtriple=sparc <%s | FileCheck %s --check-prefix=V8
3; RUN: llc -mtriple=sparcv9 <%s | FileCheck %s --check-prefix=V9
4
5; V8-LABEL: test
6; V8:       save %sp
7; V8:       call foo
8; V8-NEXT:  nop
9; V8:       call bar
10; V8-NEXT:  nop
11; V8:       ret
12; V8-NEXT:  restore
13
14; V9-LABEL: test
15; V9:       save %sp
16; V9:       call foo
17; V9-NEXT:  nop
18; V9:       call bar
19; V9-NEXT:  nop
20; V9:       ret
21; V9-NEXT:  restore
22
23define void @test() #0 {
24entry:
25 %0 = tail call i32 (...) @foo() nounwind
26 tail call void (...) @bar() nounwind
27 ret void
28}
29
30declare i32 @foo(...)
31
32declare void @bar(...)
33
34; V8-LABEL: test_tail_call_with_return
35; V8:       mov %o7, %g1
36; V8-NEXT:  call foo
37; V8-NEXT:  mov %g1, %o7
38
39; V9-LABEL: test_tail_call_with_return
40; V9:       mov %o7, %g1
41; V9-NEXT:  call foo
42; V9-NEXT:  mov %g1, %o7
43
44define i32 @test_tail_call_with_return() nounwind {
45entry:
46 %0 = tail call i32 (...) @foo() nounwind
47 ret i32 %0
48}
49
50attributes #0 = { nounwind "disable-tail-calls"="true" }
51