xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc -O0 <%s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc   <%s | FileCheck %s --check-prefix=V8
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparcv9 <%s | FileCheck %s --check-prefix=V9
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test
6*9880d681SAndroid Build Coastguard Worker; V8:       save %sp
7*9880d681SAndroid Build Coastguard Worker; V8:       call foo
8*9880d681SAndroid Build Coastguard Worker; V8-NEXT:  nop
9*9880d681SAndroid Build Coastguard Worker; V8:       call bar
10*9880d681SAndroid Build Coastguard Worker; V8-NEXT:  nop
11*9880d681SAndroid Build Coastguard Worker; V8:       ret
12*9880d681SAndroid Build Coastguard Worker; V8-NEXT:  restore
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test
15*9880d681SAndroid Build Coastguard Worker; V9:       save %sp
16*9880d681SAndroid Build Coastguard Worker; V9:       call foo
17*9880d681SAndroid Build Coastguard Worker; V9-NEXT:  nop
18*9880d681SAndroid Build Coastguard Worker; V9:       call bar
19*9880d681SAndroid Build Coastguard Worker; V9-NEXT:  nop
20*9880d681SAndroid Build Coastguard Worker; V9:       ret
21*9880d681SAndroid Build Coastguard Worker; V9-NEXT:  restore
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerdefine void @test() nounwind {
24*9880d681SAndroid Build Coastguard Workerentry:
25*9880d681SAndroid Build Coastguard Worker %0 = tail call i32 (...) @foo() nounwind
26*9880d681SAndroid Build Coastguard Worker tail call void (...) @bar() nounwind
27*9880d681SAndroid Build Coastguard Worker ret void
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdeclare i32 @foo(...)
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdeclare void @bar(...)
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_tail_call_with_return
36*9880d681SAndroid Build Coastguard Worker; V8:       save %sp
37*9880d681SAndroid Build Coastguard Worker; V8:       call foo
38*9880d681SAndroid Build Coastguard Worker; V8-NEXT:  nop
39*9880d681SAndroid Build Coastguard Worker; V8:       ret
40*9880d681SAndroid Build Coastguard Worker; V8-NEXT:  restore %g0, %o0, %o0
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_tail_call_with_return
43*9880d681SAndroid Build Coastguard Worker; V9:       save %sp
44*9880d681SAndroid Build Coastguard Worker; V9:       call foo
45*9880d681SAndroid Build Coastguard Worker; V9-NEXT:  nop
46*9880d681SAndroid Build Coastguard Worker; V9:       ret
47*9880d681SAndroid Build Coastguard Worker; V9-NEXT:  restore %g0, %o0, %o0
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workerdefine i32 @test_tail_call_with_return() nounwind {
50*9880d681SAndroid Build Coastguard Workerentry:
51*9880d681SAndroid Build Coastguard Worker %0 = tail call i32 (...) @foo() nounwind
52*9880d681SAndroid Build Coastguard Worker ret i32 %0
53*9880d681SAndroid Build Coastguard Worker}
54