xref: /llvm-project/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir (revision 012ea747ed0275c499f69c82ac0f635f4c76f746)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2# RUN: llc -start-before=machine-latecleanup -stop-after=machine-latecleanup \
3# RUN:   -o - %s | FileCheck %s
4--- |
5  ; ModuleID = 'reduced5.ll'
6  source_filename = "reduced5.ll"
7  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
8  target triple = "aarch64-unknown-linux-gnu"
9
10  ; Function Attrs: nounwind
11  define void @zot(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, i1 %arg4, ptr %arg5) #0 {
12  bb:
13    %const = bitcast i64 29273397577910035 to i64
14    callbr void asm sideeffect "b $0", "!i"()
15            to label %bb9 [label %bb8]
16
17  bb8:                                              ; preds = %bb
18    %const_mat = add i64 %const, 2048
19    br label %bb9
20
21  bb9:                                              ; preds = %bb8, %bb
22    %phi = phi i64 [ %const_mat, %bb8 ], [ %const, %bb ]
23    store volatile i64 %phi, ptr null, align 8
24    br label %bb10
25
26  bb10:                                             ; preds = %bb22, %bb9
27    %phi11 = phi i64 [ 0, %bb9 ], [ %or24, %bb22 ]
28    %phi12 = phi i64 [ 0, %bb9 ], [ %select, %bb22 ]
29    %load = load volatile i64, ptr %arg2, align 8
30    %select = select i1 %arg4, i64 %arg3, i64 0
31    store i64 %const, ptr %arg5, align 8
32    %call = call i64 %arg()
33    callbr void asm sideeffect "", "!i"()
34            to label %bb22 [label %bb22]
35
36  bb22:                                             ; preds = %bb10, %bb10
37    store i64 0, ptr %arg1, align 8
38    store volatile i64 1, ptr null, align 8
39    %or = or i64 %phi11, 0
40    %or24 = or i64 %phi11, %phi12
41    br label %bb10
42  }
43
44  attributes #0 = { nounwind "frame-pointer"="non-leaf" }
45
46...
47---
48name:            zot
49alignment:       4
50exposesReturnsTwice: false
51legalized:       false
52regBankSelected: false
53selected:        false
54failedISel:      false
55tracksRegLiveness: true
56hasWinCFI:       false
57callsEHReturn:   false
58callsUnwindInit: false
59hasEHCatchret:   false
60hasEHScopes:     false
61hasEHFunclets:   false
62isOutlined:      false
63debugInstrRef:   false
64failsVerification: false
65tracksDebugUserValues: true
66registers:       []
67liveins:
68  - { reg: '$x0', virtual-reg: '' }
69  - { reg: '$x1', virtual-reg: '' }
70  - { reg: '$x2', virtual-reg: '' }
71  - { reg: '$x3', virtual-reg: '' }
72  - { reg: '$w4', virtual-reg: '' }
73  - { reg: '$x5', virtual-reg: '' }
74frameInfo:
75  isFrameAddressTaken: false
76  isReturnAddressTaken: false
77  hasStackMap:     false
78  hasPatchPoint:   false
79  stackSize:       96
80  offsetAdjustment: 0
81  maxAlignment:    8
82  adjustsStack:    true
83  hasCalls:        true
84  stackProtector:  ''
85  functionContext: ''
86  maxCallFrameSize: 0
87  cvBytesOfCalleeSavedRegisters: 0
88  hasOpaqueSPAdjustment: false
89  hasVAStart:      false
90  hasMustTailInVarArgFunc: false
91  hasTailCall:     false
92  localFrameSize:  0
93  savePoint:       ''
94  restorePoint:    ''
95fixedStack:      []
96stack:
97  - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
98      stack-id: default, callee-saved-register: '$x19', callee-saved-restored: true,
99      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
100  - { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
101      stack-id: default, callee-saved-register: '$x20', callee-saved-restored: true,
102      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
103  - { id: 2, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,
104      stack-id: default, callee-saved-register: '$x21', callee-saved-restored: true,
105      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
106  - { id: 3, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8,
107      stack-id: default, callee-saved-register: '$x22', callee-saved-restored: true,
108      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
109  - { id: 4, name: '', type: spill-slot, offset: -40, size: 8, alignment: 8,
110      stack-id: default, callee-saved-register: '$x23', callee-saved-restored: true,
111      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
112  - { id: 5, name: '', type: spill-slot, offset: -48, size: 8, alignment: 8,
113      stack-id: default, callee-saved-register: '$x24', callee-saved-restored: true,
114      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
115  - { id: 6, name: '', type: spill-slot, offset: -56, size: 8, alignment: 8,
116      stack-id: default, callee-saved-register: '$x25', callee-saved-restored: true,
117      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
118  - { id: 7, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
119      stack-id: default, callee-saved-register: '$x26', callee-saved-restored: true,
120      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
121  - { id: 8, name: '', type: spill-slot, offset: -72, size: 8, alignment: 8,
122      stack-id: default, callee-saved-register: '$x27', callee-saved-restored: true,
123      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
124  - { id: 9, name: '', type: spill-slot, offset: -80, size: 8, alignment: 8,
125      stack-id: default, callee-saved-register: '$x28', callee-saved-restored: true,
126      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
127  - { id: 10, name: '', type: spill-slot, offset: -88, size: 8, alignment: 8,
128      stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
129      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
130  - { id: 11, name: '', type: spill-slot, offset: -96, size: 8, alignment: 8,
131      stack-id: default, callee-saved-register: '$fp', callee-saved-restored: true,
132      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
133callSites:       []
134debugValueSubstitutions: []
135constants:       []
136machineFunctionInfo:
137  hasRedZone:      false
138body:             |
139  ; CHECK-LABEL: name: zot
140  ; CHECK: bb.0.bb:
141  ; CHECK-NEXT:   successors: %bb.2(0x80000000), %bb.1(0x00000000)
142  ; CHECK-NEXT:   liveins: $w4, $x0, $x1, $x2, $x3, $x5, $lr, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20
143  ; CHECK-NEXT: {{  $}}
144  ; CHECK-NEXT:   early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -12 :: (store (s64) into %stack.11), (store (s64) into %stack.10)
145  ; CHECK-NEXT:   frame-setup STPXi killed $x28, killed $x27, $sp, 2 :: (store (s64) into %stack.9), (store (s64) into %stack.8)
146  ; CHECK-NEXT:   frame-setup STPXi killed $x26, killed $x25, $sp, 4 :: (store (s64) into %stack.7), (store (s64) into %stack.6)
147  ; CHECK-NEXT:   frame-setup STPXi killed $x24, killed $x23, $sp, 6 :: (store (s64) into %stack.5), (store (s64) into %stack.4)
148  ; CHECK-NEXT:   frame-setup STPXi killed $x22, killed $x21, $sp, 8 :: (store (s64) into %stack.3), (store (s64) into %stack.2)
149  ; CHECK-NEXT:   frame-setup STPXi killed $x20, killed $x19, $sp, 10 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
150  ; CHECK-NEXT:   $fp = frame-setup ADDXri $sp, 0, 0
151  ; CHECK-NEXT:   renamable $x19 = COPY $x5
152  ; CHECK-NEXT:   renamable $w20 = COPY $w4
153  ; CHECK-NEXT:   renamable $x21 = COPY $x3
154  ; CHECK-NEXT:   renamable $x22 = COPY $x2
155  ; CHECK-NEXT:   renamable $x23 = COPY $x1
156  ; CHECK-NEXT:   renamable $x24 = COPY $x0
157  ; CHECK-NEXT:   INLINEASM_BR &"b $0", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.1
158  ; CHECK-NEXT:   renamable $x8 = MOVi64imm 29273397577910035
159  ; CHECK-NEXT:   B %bb.2
160  ; CHECK-NEXT: {{  $}}
161  ; CHECK-NEXT: bb.1.bb8 (machine-block-address-taken, inlineasm-br-indirect-target):
162  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
163  ; CHECK-NEXT:   liveins: $w20, $x19, $x21, $x22, $x23, $x24
164  ; CHECK-NEXT: {{  $}}
165  ; CHECK-NEXT:   renamable $x8 = MOVi64imm 29273397577910035
166  ; CHECK-NEXT:   renamable $x8 = ADDXri killed renamable $x8, 2048, 0
167  ; CHECK-NEXT: {{  $}}
168  ; CHECK-NEXT: bb.2.bb9:
169  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
170  ; CHECK-NEXT:   liveins: $w20, $x8, $x19, $x21, $x22, $x23, $x24
171  ; CHECK-NEXT: {{  $}}
172  ; CHECK-NEXT:   renamable $x25 = COPY $xzr
173  ; CHECK-NEXT:   renamable $w27 = MOVi32imm 1, implicit-def $x27
174  ; CHECK-NEXT:   renamable $x26 = COPY $xzr
175  ; CHECK-NEXT:   STRXui killed renamable $x8, renamable $x25, 0 :: (volatile store (s64) into `ptr null`)
176  ; CHECK-NEXT: {{  $}}
177  ; CHECK-NEXT: bb.3.bb10:
178  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
179  ; CHECK-NEXT:   liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27
180  ; CHECK-NEXT: {{  $}}
181  ; CHECK-NEXT:   dead $wzr = ANDSWri renamable $w20, 0, implicit-def $nzcv
182  ; CHECK-NEXT:   dead $xzr = LDRXui renamable $x22, 0 :: (volatile load (s64) from %ir.arg2)
183  ; CHECK-NEXT:   renamable $x28 = CSELXr renamable $x21, $xzr, 1, implicit killed $nzcv
184  ; CHECK-NEXT:   renamable $x8 = MOVi64imm 29273397577910035
185  ; CHECK-NEXT:   STRXui killed renamable $x8, renamable $x19, 0 :: (store (s64) into %ir.arg5)
186  ; CHECK-NEXT:   BLR renamable $x24, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
187  ; CHECK-NEXT:   INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.4
188  ; CHECK-NEXT:   B %bb.4
189  ; CHECK-NEXT: {{  $}}
190  ; CHECK-NEXT: bb.4.bb22 (machine-block-address-taken, inlineasm-br-indirect-target):
191  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
192  ; CHECK-NEXT:   liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
193  ; CHECK-NEXT: {{  $}}
194  ; CHECK-NEXT:   renamable $x8 = COPY $xzr
195  ; CHECK-NEXT:   renamable $x25 = ORRXrr killed renamable $x25, killed renamable $x26
196  ; CHECK-NEXT:   renamable $x26 = COPY killed renamable $x28
197  ; CHECK-NEXT:   STRXui $xzr, renamable $x23, 0 :: (store (s64) into %ir.arg1)
198  ; CHECK-NEXT:   STRXui renamable $x27, killed renamable $x8, 0 :: (volatile store (s64) into `ptr null`)
199  ; CHECK-NEXT:   B %bb.3
200  bb.0.bb:
201    successors: %bb.2(0x80000000), %bb.1(0x00000000)
202    liveins: $w4, $x0, $x1, $x2, $x3, $x5, $lr, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20
203
204    early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -12 :: (store (s64) into %stack.11), (store (s64) into %stack.10)
205    frame-setup STPXi killed $x28, killed $x27, $sp, 2 :: (store (s64) into %stack.9), (store (s64) into %stack.8)
206    frame-setup STPXi killed $x26, killed $x25, $sp, 4 :: (store (s64) into %stack.7), (store (s64) into %stack.6)
207    frame-setup STPXi killed $x24, killed $x23, $sp, 6 :: (store (s64) into %stack.5), (store (s64) into %stack.4)
208    frame-setup STPXi killed $x22, killed $x21, $sp, 8 :: (store (s64) into %stack.3), (store (s64) into %stack.2)
209    frame-setup STPXi killed $x20, killed $x19, $sp, 10 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
210    $fp = frame-setup ADDXri $sp, 0, 0
211    renamable $x19 = COPY $x5
212    renamable $w20 = COPY $w4
213    renamable $x21 = COPY $x3
214    renamable $x22 = COPY $x2
215    renamable $x23 = COPY $x1
216    renamable $x24 = COPY $x0
217    INLINEASM_BR &"b $0", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.1
218    renamable $x8 = MOVi64imm 29273397577910035
219    B %bb.2
220
221  bb.1.bb8 (machine-block-address-taken, inlineasm-br-indirect-target):
222    successors: %bb.2(0x80000000)
223    liveins: $w20, $x19, $x21, $x22, $x23, $x24
224
225    renamable $x8 = MOVi64imm 29273397577910035
226    renamable $x8 = ADDXri killed renamable $x8, 2048, 0
227
228  bb.2.bb9:
229    successors: %bb.3(0x80000000)
230    liveins: $w20, $x8, $x19, $x21, $x22, $x23, $x24
231
232    renamable $x25 = COPY $xzr
233    renamable $w27 = MOVi32imm 1, implicit-def $x27
234    renamable $x26 = COPY $xzr
235    STRXui killed renamable $x8, renamable $x25, 0 :: (volatile store (s64) into `ptr null`)
236
237  bb.3.bb10:
238    successors: %bb.4(0x80000000)
239    liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27
240
241    dead $wzr = ANDSWri renamable $w20, 0, implicit-def $nzcv
242    dead $xzr = LDRXui renamable $x22, 0 :: (volatile load (s64) from %ir.arg2)
243    renamable $x28 = CSELXr renamable $x21, $xzr, 1, implicit killed $nzcv
244    renamable $x8 = MOVi64imm 29273397577910035
245    STRXui killed renamable $x8, renamable $x19, 0 :: (store (s64) into %ir.arg5)
246    BLR renamable $x24, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
247    INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.4
248    B %bb.4
249
250  bb.4.bb22 (machine-block-address-taken, inlineasm-br-indirect-target):
251    successors: %bb.3(0x80000000)
252    liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
253
254    renamable $x8 = COPY $xzr
255    renamable $x25 = ORRXrr killed renamable $x25, killed renamable $x26
256    renamable $x26 = COPY killed renamable $x28
257    STRXui $xzr, renamable $x23, 0 :: (store (s64) into %ir.arg1)
258    STRXui renamable $x27, killed renamable $x8, 0 :: (volatile store (s64) into `ptr null`)
259    B %bb.3
260
261...
262