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