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 4 5; tailcc will turn all of these musttail calls into tail calls. 6 7declare dso_local tailcc i32 @tailcallee(i32 %a1, i32 %a2) 8 9define tailcc i32 @tailcaller(i32 %in1, i32 %in2) nounwind { 10; X64-LABEL: tailcaller: 11; X64: # %bb.0: # %entry 12; X64-NEXT: jmp tailcallee # TAILCALL 13; 14; X32-LABEL: tailcaller: 15; X32: # %bb.0: # %entry 16; X32-NEXT: jmp tailcallee # TAILCALL 17entry: 18 %tmp11 = musttail call tailcc i32 @tailcallee(i32 %in1, i32 %in2) 19 ret i32 %tmp11 20} 21 22declare dso_local tailcc i8* @alias_callee() 23 24define tailcc noalias i8* @noalias_caller() nounwind { 25; X64-LABEL: noalias_caller: 26; X64: # %bb.0: 27; X64-NEXT: jmp alias_callee # TAILCALL 28; 29; X32-LABEL: noalias_caller: 30; X32: # %bb.0: 31; X32-NEXT: jmp alias_callee # TAILCALL 32 %p = musttail call tailcc i8* @alias_callee() 33 ret i8* %p 34} 35 36declare dso_local tailcc noalias i8* @noalias_callee() 37 38define tailcc i8* @alias_caller() nounwind { 39; X64-LABEL: alias_caller: 40; X64: # %bb.0: 41; X64-NEXT: jmp noalias_callee # TAILCALL 42; 43; X32-LABEL: alias_caller: 44; X32: # %bb.0: 45; X32-NEXT: jmp noalias_callee # TAILCALL 46 %p = musttail call tailcc noalias i8* @noalias_callee() 47 ret i8* %p 48} 49 50define tailcc void @void_test(i32, i32, i32, i32) { 51; X64-LABEL: void_test: 52; X64: # %bb.0: # %entry 53; X64-NEXT: jmp void_test # TAILCALL 54; 55; X32-LABEL: void_test: 56; X32: # %bb.0: # %entry 57; X32-NEXT: pushl %esi 58; X32-NEXT: .cfi_def_cfa_offset 8 59; X32-NEXT: .cfi_offset %esi, -8 60; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 61; X32-NEXT: movl {{[0-9]+}}(%esp), %esi 62; X32-NEXT: movl %esi, {{[0-9]+}}(%esp) 63; X32-NEXT: movl %eax, {{[0-9]+}}(%esp) 64; X32-NEXT: popl %esi 65; X32-NEXT: .cfi_def_cfa_offset 4 66; X32-NEXT: jmp void_test # TAILCALL 67 entry: 68 musttail call tailcc void @void_test( i32 %0, i32 %1, i32 %2, i32 %3) 69 ret void 70} 71 72define tailcc i1 @i1test(i32, i32, i32, i32) { 73; X64-LABEL: i1test: 74; X64: # %bb.0: # %entry 75; X64-NEXT: jmp i1test # TAILCALL 76; 77; X32-LABEL: i1test: 78; X32: # %bb.0: # %entry 79; X32-NEXT: pushl %esi 80; X32-NEXT: .cfi_def_cfa_offset 8 81; X32-NEXT: .cfi_offset %esi, -8 82; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 83; X32-NEXT: movl {{[0-9]+}}(%esp), %esi 84; X32-NEXT: movl %esi, {{[0-9]+}}(%esp) 85; X32-NEXT: movl %eax, {{[0-9]+}}(%esp) 86; X32-NEXT: popl %esi 87; X32-NEXT: .cfi_def_cfa_offset 4 88; X32-NEXT: jmp i1test # TAILCALL 89 entry: 90 %4 = musttail call tailcc i1 @i1test( i32 %0, i32 %1, i32 %2, i32 %3) 91 ret i1 %4 92} 93