1 # RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog -filetype=obj \
2 # RUN: | llvm-readobj --unwind | FileCheck %s
3 # This test case checks the basic validity of the .xdata section. It's
5 # https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
7 # We expect to see the following in the .xdata section:
9 # CHECK: ExceptionData {
10 # CHECK-NEXT: FunctionLength: 92
11 # CHECK-NEXT: Version: 0
12 # CHECK-NEXT: ExceptionData: No
13 # CHECK-NEXT: EpiloguePacked: No
14 # CHECK-NEXT: EpilogueScopes: 1
15 # CHECK-NEXT: ByteCodeLength: 28
16 # CHECK-NEXT: Prologue [
17 # CHECK-NEXT: 0xc808 ; stp x19, x20, [sp, #64]
18 # CHECK-NEXT: 0xd0c7 ; str x22, [sp, #56]
19 # CHECK-NEXT: 0xd086 ; str x21, [sp, #48]
20 # CHECK-NEXT: 0xc904 ; stp x23, x24, [sp, #32]
21 # CHECK-NEXT: 0xc982 ; stp x25, x26, [sp, #16]
22 # CHECK-NEXT: 0xce09 ; stp x27, x28, [sp, #-80]!
23 # CHECK-NEXT: 0xe4 ; end
25 # CHECK-NEXT: EpilogueScopes [
26 # CHECK-NEXT: EpilogueScope {
27 # CHECK-NEXT: StartOffset: 15
28 # CHECK-NEXT: EpilogueStartIndex: 13
29 # CHECK-NEXT: Opcodes [
30 # CHECK-NEXT: 0xc808 ; ldp x19, x20, [sp, #64]
31 # CHECK-NEXT: 0xd086 ; ldr x21, [sp, #48]
32 # CHECK-NEXT: 0xe3 ; nop
33 # CHECK-NEXT: 0xd0c7 ; ldr x22, [sp, #56]
34 # CHECK-NEXT: 0xc904 ; ldp x23, x24, [sp, #32]
35 # CHECK-NEXT: 0xc982 ; ldp x25, x26, [sp, #16]
36 # CHECK-NEXT: 0xce09 ; ldp x27, x28, [sp], #80
37 # CHECK-NEXT: 0xe4 ; end
46 tracksRegLiveness: true
54 hasOpaqueSPAdjustment: true
56 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: default,
57 callee-saved-register: '$x19' }
58 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: default,
59 callee-saved-register: '$x20' }
60 - { id: 2, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
61 callee-saved-register: '$x21' }
62 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 8, stack-id: default,
63 callee-saved-register: '$x22' }
64 - { id: 4, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
65 callee-saved-register: '$x23' }
66 - { id: 5, type: spill-slot, offset: -48, size: 8, alignment: 8, stack-id: default,
67 callee-saved-register: '$x24' }
68 - { id: 6, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
69 callee-saved-register: '$x25' }
70 - { id: 7, type: spill-slot, offset: -64, size: 8, alignment: 8, stack-id: default,
71 callee-saved-register: '$x26' }
72 - { id: 8, type: spill-slot, offset: -72, size: 8, alignment: 8, stack-id: default,
73 callee-saved-register: '$x27' }
74 - { id: 9, type: spill-slot, offset: -80, size: 8, alignment: 8, stack-id: default,
75 callee-saved-register: '$x28' }
78 liveins: $x0, $x1, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20
79 early-clobber $sp = frame-setup STPXpre killed $x27, killed $x28, $sp, -10 :: (store 8 into %stack.8), (store 8 into %stack.9)
80 frame-setup SEH_SaveRegP_X 27, 28, -80
81 frame-setup STPXi killed $x25, killed $x26, $sp, 2 :: (store 8 into %stack.6), (store 8 into %stack.7)
82 frame-setup SEH_SaveRegP 25, 26, 16
83 frame-setup STPXi killed $x23, killed $x24, $sp, 4 :: (store 8 into %stack.4), (store 8 into %stack.5)
84 frame-setup SEH_SaveRegP 23, 24, 32
85 frame-setup STRXui killed $x21, $sp, 6 :: (store 8 into %stack.2)
86 frame-setup SEH_SaveReg 21, 48
87 frame-setup STRXui killed $x22, $sp, 7 :: (store 8 into %stack.3)
88 frame-setup SEH_SaveReg 22, 56
89 frame-setup STPXi killed $x19, killed $x20, $sp, 8 :: (store 8 into %stack.0), (store 8 into %stack.1)
90 frame-setup SEH_SaveRegP 19, 20, 64
91 frame-setup SEH_PrologEnd
92 $x19 = ADDXrr $x0, killed $x1
93 $x20 = ADDXrr $x19, killed $x0
94 $x21 = ADDXrr $x20, killed $x19
95 $x22 = ADDXrr $x21, killed $x20
96 $x23 = ADDXrr $x22, killed $x21
97 $x24 = ADDXrr $x23, killed $x22
98 $x25 = ADDXrr $x24, killed $x23
99 $x26 = ADDXrr $x25, killed $x24
100 $x27 = ADDXrr $x26, killed $x25
101 $x28 = ADDXrr $x27, killed $x26
102 frame-destroy SEH_EpilogStart
103 $x19, $x20 = frame-destroy LDPXi $sp, 8 :: (load 8 from %stack.0), (load 8 from %stack.1)
104 frame-destroy SEH_SaveRegP 19, 20, 64
105 $x21 = frame-destroy LDRXui $sp, 6 :: (load 8 from %stack.2)
106 frame-destroy SEH_SaveReg 21, 48
108 frame-destroy SEH_Nop
109 $x21 = frame-destroy LDRXui $sp, 6 :: (load 8 from %stack.2)
110 frame-destroy SEH_SaveReg 22, 56
111 $x23, $x24 = frame-destroy LDPXi $sp, 4 :: (load 8 from %stack.4), (load 8 from %stack.5)
112 frame-destroy SEH_SaveRegP 23, 24, 32
113 $x25, $x26 = frame-destroy LDPXi $sp, 2 :: (load 8 from %stack.6), (load 8 from %stack.7)
114 frame-destroy SEH_SaveRegP 25, 26, 16
115 early-clobber $sp, $x27, $x28 = frame-destroy LDPXpost $sp, 10 :: (load 8 from %stack.8), (load 8 from %stack.9)
116 frame-destroy SEH_SaveRegP_X 27, 28, -80
117 frame-destroy SEH_EpilogEnd
118 RET_ReallyLR implicit $x0