1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=arm64-apple-ios-8.0.0 | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @standard_cc_func() 4*9880d681SAndroid Build Coastguard Workerdeclare preserve_mostcc void @preserve_mostcc_func() 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; Registers r9-r15 should be saved before the call of a function 7*9880d681SAndroid Build Coastguard Worker; with a standard calling convention. 8*9880d681SAndroid Build Coastguard Workerdefine preserve_mostcc void @preserve_mostcc1() nounwind { 9*9880d681SAndroid Build Coastguard Workerentry: 10*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: preserve_mostcc1 11*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: stp 12*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: str 13*9880d681SAndroid Build Coastguard Worker;CHECK: str x15 14*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: stp x14, x13, 15*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: stp x12, x11, 16*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: stp x10, x9, 17*9880d681SAndroid Build Coastguard Worker;CHECK: bl _standard_cc_func 18*9880d681SAndroid Build Coastguard Worker call void @standard_cc_func() 19*9880d681SAndroid Build Coastguard Worker;CHECK: ldp x10, x9, 20*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: ldp x12, x11, 21*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: ldp x14, x13, 22*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: ldr x15 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker; Registers r9-r15 don't need to be saved if one 27*9880d681SAndroid Build Coastguard Worker; function with preserve_mostcc calling convention calls another 28*9880d681SAndroid Build Coastguard Worker; function with preserve_mostcc calling convention, because the 29*9880d681SAndroid Build Coastguard Worker; callee wil save these registers anyways. 30*9880d681SAndroid Build Coastguard Workerdefine preserve_mostcc void @preserve_mostcc2() nounwind { 31*9880d681SAndroid Build Coastguard Workerentry: 32*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: preserve_mostcc2 33*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: x14 34*9880d681SAndroid Build Coastguard Worker;CHECK: stp x29, x30, 35*9880d681SAndroid Build Coastguard Worker;CHECK-NOT: x14 36*9880d681SAndroid Build Coastguard Worker;CHECK: bl _preserve_mostcc_func 37*9880d681SAndroid Build Coastguard Worker call preserve_mostcc void @preserve_mostcc_func() 38*9880d681SAndroid Build Coastguard Worker ret void 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41