1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme -verify-machineinstrs < %s | FileCheck %s
4 declare void @private_za_callee()
6 ; Ensure that we don't use tail call optimization when a lazy-save is required.
7 define void @disable_tailcallopt() "aarch64_inout_za" nounwind {
8 ; CHECK-LABEL: disable_tailcallopt:
10 ; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
11 ; CHECK-NEXT: mov x29, sp
12 ; CHECK-NEXT: sub sp, sp, #16
13 ; CHECK-NEXT: rdsvl x8, #1
14 ; CHECK-NEXT: mov x9, sp
15 ; CHECK-NEXT: msub x9, x8, x8, x9
16 ; CHECK-NEXT: mov sp, x9
17 ; CHECK-NEXT: stur x9, [x29, #-16]
18 ; CHECK-NEXT: sub x9, x29, #16
19 ; CHECK-NEXT: sturh wzr, [x29, #-6]
20 ; CHECK-NEXT: stur wzr, [x29, #-4]
21 ; CHECK-NEXT: sturh w8, [x29, #-8]
22 ; CHECK-NEXT: msr TPIDR2_EL0, x9
23 ; CHECK-NEXT: bl private_za_callee
24 ; CHECK-NEXT: smstart za
25 ; CHECK-NEXT: mrs x8, TPIDR2_EL0
26 ; CHECK-NEXT: sub x0, x29, #16
27 ; CHECK-NEXT: cbnz x8, .LBB0_2
28 ; CHECK-NEXT: // %bb.1:
29 ; CHECK-NEXT: bl __arm_tpidr2_restore
30 ; CHECK-NEXT: .LBB0_2:
31 ; CHECK-NEXT: msr TPIDR2_EL0, xzr
32 ; CHECK-NEXT: mov sp, x29
33 ; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
35 tail call void @private_za_callee()
39 ; Ensure we set up and restore the lazy save correctly for instructions which are lowered to lib calls
40 define fp128 @f128_call_za(fp128 %a, fp128 %b) "aarch64_inout_za" nounwind {
41 ; CHECK-LABEL: f128_call_za:
43 ; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
44 ; CHECK-NEXT: mov x29, sp
45 ; CHECK-NEXT: sub sp, sp, #16
46 ; CHECK-NEXT: rdsvl x8, #1
47 ; CHECK-NEXT: mov x9, sp
48 ; CHECK-NEXT: msub x9, x8, x8, x9
49 ; CHECK-NEXT: mov sp, x9
50 ; CHECK-NEXT: stur x9, [x29, #-16]
51 ; CHECK-NEXT: sub x9, x29, #16
52 ; CHECK-NEXT: sturh wzr, [x29, #-6]
53 ; CHECK-NEXT: stur wzr, [x29, #-4]
54 ; CHECK-NEXT: sturh w8, [x29, #-8]
55 ; CHECK-NEXT: msr TPIDR2_EL0, x9
56 ; CHECK-NEXT: bl __addtf3
57 ; CHECK-NEXT: smstart za
58 ; CHECK-NEXT: mrs x8, TPIDR2_EL0
59 ; CHECK-NEXT: sub x0, x29, #16
60 ; CHECK-NEXT: cbnz x8, .LBB1_2
61 ; CHECK-NEXT: // %bb.1:
62 ; CHECK-NEXT: bl __arm_tpidr2_restore
63 ; CHECK-NEXT: .LBB1_2:
64 ; CHECK-NEXT: msr TPIDR2_EL0, xzr
65 ; CHECK-NEXT: mov sp, x29
66 ; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
68 %res = fadd fp128 %a, %b