1; RUN: llc -march=sparc -O0 <%s
2; RUN: llc -march=sparc   <%s | FileCheck %s --check-prefix=V8
3; RUN: llc -march=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:       jmp %i7+8
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:       jmp %i7+8
21; V9-NEXT:  restore
22
23define void @test() nounwind {
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
35; V8-LABEL: test_tail_call_with_return
36; V8:       save %sp
37; V8:       call foo
38; V8-NEXT:  nop
39; V8:       jmp %i7+8
40; V8-NEXT:  restore %g0, %o0, %o0
41
42; V9-LABEL: test_tail_call_with_return
43; V9:       save %sp
44; V9:       call foo
45; V9-NEXT:  nop
46; V9:       jmp %i7+8
47; V9-NEXT:  restore %g0, %o0, %o0
48
49define i32 @test_tail_call_with_return() nounwind {
50entry:
51 %0 = tail call i32 (...)* @foo() nounwind
52 ret i32 %0
53}
54