1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s -check-prefix=X64
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s -check-prefix=X32
5 ; tailcc will turn all of these musttail calls into tail calls.
7 declare tailcc i32 @tailcallee(i32 %a1, i32 %a2)
9 define tailcc i32 @tailcaller(i32 %in1, i32 %in2) nounwind {
10 ; X64-LABEL: tailcaller:
11 ; X64: # %bb.0: # %entry
12 ; X64-NEXT: pushq %rax
14 ; X64-NEXT: jmp tailcallee # TAILCALL
16 ; X32-LABEL: tailcaller:
17 ; X32: # %bb.0: # %entry
18 ; X32-NEXT: jmp tailcallee # TAILCALL
20 %tmp11 = musttail call tailcc i32 @tailcallee(i32 %in1, i32 %in2)
24 declare tailcc i8* @alias_callee()
26 define tailcc noalias i8* @noalias_caller() nounwind {
27 ; X64-LABEL: noalias_caller:
29 ; X64-NEXT: pushq %rax
31 ; X64-NEXT: jmp alias_callee # TAILCALL
33 ; X32-LABEL: noalias_caller:
35 ; X32-NEXT: jmp alias_callee # TAILCALL
36 %p = musttail call tailcc i8* @alias_callee()
40 declare tailcc noalias i8* @noalias_callee()
42 define tailcc i8* @alias_caller() nounwind {
43 ; X64-LABEL: alias_caller:
45 ; X64-NEXT: pushq %rax
47 ; X64-NEXT: jmp noalias_callee # TAILCALL
49 ; X32-LABEL: alias_caller:
51 ; X32-NEXT: jmp noalias_callee # TAILCALL
52 %p = musttail call tailcc noalias i8* @noalias_callee()
56 define tailcc void @void_test(i32, i32, i32, i32) {
57 ; X64-LABEL: void_test:
58 ; X64: # %bb.0: # %entry
59 ; X64-NEXT: pushq %rax
60 ; X64-NEXT: .cfi_def_cfa_offset 16
62 ; X64-NEXT: .cfi_def_cfa_offset 8
63 ; X64-NEXT: jmp void_test # TAILCALL
65 ; X32-LABEL: void_test:
66 ; X32: # %bb.0: # %entry
67 ; X32-NEXT: pushl %esi
68 ; X32-NEXT: .cfi_def_cfa_offset 8
69 ; X32-NEXT: subl $8, %esp
70 ; X32-NEXT: .cfi_def_cfa_offset 16
71 ; X32-NEXT: .cfi_offset %esi, -8
72 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
73 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
74 ; X32-NEXT: movl %esi, {{[0-9]+}}(%esp)
75 ; X32-NEXT: movl %eax, {{[0-9]+}}(%esp)
76 ; X32-NEXT: addl $8, %esp
77 ; X32-NEXT: .cfi_def_cfa_offset 8
79 ; X32-NEXT: .cfi_def_cfa_offset 4
80 ; X32-NEXT: jmp void_test # TAILCALL
82 musttail call tailcc void @void_test( i32 %0, i32 %1, i32 %2, i32 %3)
86 define tailcc i1 @i1test(i32, i32, i32, i32) {
88 ; X64: # %bb.0: # %entry
89 ; X64-NEXT: pushq %rax
90 ; X64-NEXT: .cfi_def_cfa_offset 16
92 ; X64-NEXT: .cfi_def_cfa_offset 8
93 ; X64-NEXT: jmp i1test # TAILCALL
96 ; X32: # %bb.0: # %entry
97 ; X32-NEXT: pushl %esi
98 ; X32-NEXT: .cfi_def_cfa_offset 8
99 ; X32-NEXT: subl $8, %esp
100 ; X32-NEXT: .cfi_def_cfa_offset 16
101 ; X32-NEXT: .cfi_offset %esi, -8
102 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
103 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
104 ; X32-NEXT: movl %esi, {{[0-9]+}}(%esp)
105 ; X32-NEXT: movl %eax, {{[0-9]+}}(%esp)
106 ; X32-NEXT: addl $8, %esp
107 ; X32-NEXT: .cfi_def_cfa_offset 8
108 ; X32-NEXT: popl %esi
109 ; X32-NEXT: .cfi_def_cfa_offset 4
110 ; X32-NEXT: jmp i1test # TAILCALL
112 %4 = musttail call tailcc i1 @i1test( i32 %0, i32 %1, i32 %2, i32 %3)