1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
4 # Verify register banks for G_ASSERT_SEXT.
12 tracksRegLiveness: true
17 ; G_ASSERT_SEXT should end up on a GPR.
19 ; CHECK-LABEL: name: gpr
20 ; CHECK: liveins: $w0, $w1
22 ; CHECK-NEXT: %copy:gpr(s32) = COPY $w0
23 ; CHECK-NEXT: %copy_assert_sext:gpr(s32) = G_ASSERT_SEXT %copy, 16
24 ; CHECK-NEXT: $w1 = COPY %copy_assert_sext(s32)
25 ; CHECK-NEXT: RET_ReallyLR implicit $w1
26 %copy:_(s32) = COPY $w0
27 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
28 $w1 = COPY %copy_assert_sext(s32)
29 RET_ReallyLR implicit $w1
36 tracksRegLiveness: true
41 ; G_ASSERT_SEXT should end up on a GPR.
43 ; CHECK-LABEL: name: gpr_vector
44 ; CHECK: liveins: $x0, $x1
46 ; CHECK-NEXT: %copy:gpr(<2 x s32>) = COPY $x0
47 ; CHECK-NEXT: %copy_assert_sext:gpr(<2 x s32>) = G_ASSERT_SEXT %copy, 16
48 ; CHECK-NEXT: $x1 = COPY %copy_assert_sext(<2 x s32>)
49 ; CHECK-NEXT: RET_ReallyLR implicit $x1
50 %copy:_(<2 x s32>) = COPY $x0
51 %copy_assert_sext:_(<2 x s32>) = G_ASSERT_SEXT %copy(<2 x s32>), 16
52 $x1 = COPY %copy_assert_sext(<2 x s32>)
53 RET_ReallyLR implicit $x1
60 tracksRegLiveness: true
65 ; G_ASSERT_SEXT should end up on a FPR.
67 ; CHECK-LABEL: name: fpr
68 ; CHECK: liveins: $s0, $s1
70 ; CHECK-NEXT: %copy:fpr(s32) = COPY $s0
71 ; CHECK-NEXT: %copy_assert_sext:fpr(s32) = G_ASSERT_SEXT %copy, 16
72 ; CHECK-NEXT: $s1 = COPY %copy_assert_sext(s32)
73 ; CHECK-NEXT: RET_ReallyLR implicit $s1
74 %copy:_(s32) = COPY $s0
75 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
76 $s1 = COPY %copy_assert_sext(s32)
77 RET_ReallyLR implicit $s1
84 tracksRegLiveness: true
89 ; G_ASSERT_SEXT should end up on a FPR.
91 ; CHECK-LABEL: name: fpr_vector
92 ; CHECK: liveins: $d0, $d1
94 ; CHECK-NEXT: %copy:fpr(<2 x s32>) = COPY $d0
95 ; CHECK-NEXT: %copy_assert_sext:fpr(<2 x s32>) = G_ASSERT_SEXT %copy, 16
96 ; CHECK-NEXT: $d1 = COPY %copy_assert_sext(<2 x s32>)
97 ; CHECK-NEXT: RET_ReallyLR implicit $d1
98 %copy:_(<2 x s32>) = COPY $d0
99 %copy_assert_sext:_(<2 x s32>) = G_ASSERT_SEXT %copy(<2 x s32>), 16
100 $d1 = COPY %copy_assert_sext(<2 x s32>)
101 RET_ReallyLR implicit $d1
105 name: in_between_cross_bank_copy
108 tracksRegLiveness: true
113 ; CHECK-LABEL: name: in_between_cross_bank_copy
114 ; CHECK: liveins: $s0, $w1
116 ; CHECK-NEXT: %copy:fpr(s32) = COPY $s0
117 ; CHECK-NEXT: %copy_assert_sext:fpr(s32) = G_ASSERT_SEXT %copy, 16
118 ; CHECK-NEXT: $w1 = COPY %copy_assert_sext(s32)
119 ; CHECK-NEXT: RET_ReallyLR implicit $w1
120 %copy:_(s32) = COPY $s0
121 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
122 $w1 = COPY %copy_assert_sext(s32)
123 RET_ReallyLR implicit $w1
127 name: fpr_feeding_store
130 tracksRegLiveness: true
133 liveins: $x0, $s0, $s1
135 ; The G_ASSERT_SEXT should end up on a FPR, and there should be no copy
136 ; between it and the G_STORE.
138 ; CHECK-LABEL: name: fpr_feeding_store
139 ; CHECK: liveins: $x0, $s0, $s1
141 ; CHECK-NEXT: %ptr:gpr(p0) = COPY $x0
142 ; CHECK-NEXT: %copy:fpr(s32) = COPY $s0
143 ; CHECK-NEXT: %copy_assert_sext:fpr(s32) = G_ASSERT_SEXT %copy, 16
144 ; CHECK-NEXT: G_STORE %copy_assert_sext(s32), %ptr(p0) :: (store (s32))
145 ; CHECK-NEXT: RET_ReallyLR
146 %ptr:_(p0) = COPY $x0
147 %copy:_(s32) = COPY $s0
148 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
149 G_STORE %copy_assert_sext(s32), %ptr(p0) :: (store (s32))
154 name: fpr_feeding_select
157 tracksRegLiveness: true
158 machineFunctionInfo: {}
161 liveins: $d0, $x1, $w0
163 ; G_ASSERT_SEXT and G_SELECT should both end up on FPRs.
165 ; CHECK-LABEL: name: fpr_feeding_select
166 ; CHECK: liveins: $d0, $x1, $w0
168 ; CHECK-NEXT: %w0:gpr(s32) = COPY $w0
169 ; CHECK-NEXT: %fpr:fpr(s64) = COPY $d0
170 ; CHECK-NEXT: %fpr_assert_sext:fpr(s64) = G_ASSERT_SEXT %fpr, 32
171 ; CHECK-NEXT: %gpr:gpr(s64) = COPY $x1
172 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr(s64) = COPY %gpr(s64)
173 ; CHECK-NEXT: %select:fpr(s64) = G_SELECT %w0(s32), %fpr_assert_sext, [[COPY]]
174 ; CHECK-NEXT: $d0 = COPY %select(s64)
175 ; CHECK-NEXT: RET_ReallyLR implicit $d0
176 %w0:_(s32) = COPY $w0
177 %fpr:_(s64) = COPY $d0
178 %fpr_assert_sext:_(s64) = G_ASSERT_SEXT %fpr, 32
179 %gpr:_(s64) = COPY $x1
180 %select:_(s64) = G_SELECT %w0, %fpr_assert_sext, %gpr
181 $d0 = COPY %select(s64)
182 RET_ReallyLR implicit $d0
186 name: fpr_feeding_phi
189 tracksRegLiveness: true
191 ; CHECK-LABEL: name: fpr_feeding_phi
193 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
194 ; CHECK-NEXT: liveins: $s0, $w1
196 ; CHECK-NEXT: %copy1:fpr(s32) = COPY $s0
197 ; CHECK-NEXT: %copy2:gpr(s32) = COPY $w1
198 ; CHECK-NEXT: %copy_assert_sext:fpr(s32) = G_ASSERT_SEXT %copy1, 16
199 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY %copy1(s32)
200 ; CHECK-NEXT: %cmp:gpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), %copy2
201 ; CHECK-NEXT: G_BRCOND %cmp(s32), %bb.1
202 ; CHECK-NEXT: G_BR %bb.1
205 ; CHECK-NEXT: successors: %bb.2(0x80000000)
207 ; CHECK-NEXT: %bb1_val:gpr(s32) = COPY %copy2(s32)
208 ; CHECK-NEXT: G_BR %bb.2
211 ; CHECK-NEXT: successors: %bb.0(0x80000000)
213 ; CHECK-NEXT: %phi:fpr(s32) = G_PHI %copy_assert_sext(s32), %bb.0, %bb1_val(s32), %bb.1
214 ; CHECK-NEXT: G_BR %bb.0
216 successors: %bb.1, %bb.2
218 %copy1:_(s32) = COPY $s0
219 %copy2:_(s32) = COPY $w1
221 ; This should produce a FPR.
222 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy1(s32), 16
224 %cmp:_(s32) = G_ICMP intpred(eq), %copy1, %copy2
229 %bb1_val:_(s32) = COPY %copy2
233 ; This should produce a FPR.
234 %phi:_(s32) = G_PHI %copy_assert_sext, %bb.0, %bb1_val, %bb.1
242 tracksRegLiveness: true
244 ; CHECK-LABEL: name: fed_by_fpr_phi
246 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
247 ; CHECK-NEXT: liveins: $s0, $s1
249 ; CHECK-NEXT: %copy1:fpr(s32) = COPY $s0
250 ; CHECK-NEXT: %copy2:fpr(s32) = COPY $s1
251 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY %copy1(s32)
252 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr(s32) = COPY %copy2(s32)
253 ; CHECK-NEXT: %cmp:gpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
254 ; CHECK-NEXT: G_BRCOND %cmp(s32), %bb.1
255 ; CHECK-NEXT: G_BR %bb.1
258 ; CHECK-NEXT: successors: %bb.2(0x80000000)
260 ; CHECK-NEXT: %bb1_val:gpr(s32) = COPY %copy2(s32)
261 ; CHECK-NEXT: G_BR %bb.2
264 ; CHECK-NEXT: successors: %bb.0(0x80000000)
266 ; CHECK-NEXT: %phi:fpr(s32) = G_PHI %copy1(s32), %bb.0, %bb1_val(s32), %bb.1
267 ; CHECK-NEXT: %assert_sext:fpr(s32) = G_ASSERT_SEXT %phi, 16
268 ; CHECK-NEXT: G_BR %bb.0
270 successors: %bb.1, %bb.2
272 %copy1:_(s32) = COPY $s0
273 %copy2:_(s32) = COPY $s1
274 %cmp:_(s32) = G_ICMP intpred(eq), %copy1, %copy2
279 %bb1_val:_(s32) = COPY %copy2
283 ; The G_PHI and G_ASSERT_SEXT should both end up on FPRs.
284 %phi:_(s32) = G_PHI %copy1, %bb.0, %bb1_val, %bb.1
285 %assert_sext:_(s32) = G_ASSERT_SEXT %phi(s32), 16
290 name: different_blocks_gpr
293 tracksRegLiveness: true
295 ; CHECK-LABEL: name: different_blocks_gpr
297 ; CHECK-NEXT: successors: %bb.1(0x80000000)
298 ; CHECK-NEXT: liveins: $w0, $w1
300 ; CHECK-NEXT: %copy:gpr(s32) = COPY $w0
301 ; CHECK-NEXT: G_BR %bb.1
304 ; CHECK-NEXT: %copy_assert_sext:gpr(s32) = G_ASSERT_SEXT %copy, 16
305 ; CHECK-NEXT: $w1 = COPY %copy_assert_sext(s32)
306 ; CHECK-NEXT: RET_ReallyLR implicit $w1
310 %copy:_(s32) = COPY $w0
313 ; The G_ASSERT_SEXT should end up on a GPR.
314 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
315 $w1 = COPY %copy_assert_sext
316 RET_ReallyLR implicit $w1
320 name: different_blocks_fpr
323 tracksRegLiveness: true
325 ; CHECK-LABEL: name: different_blocks_fpr
327 ; CHECK-NEXT: successors: %bb.1(0x80000000)
328 ; CHECK-NEXT: liveins: $s0, $s1
330 ; CHECK-NEXT: %copy:fpr(s32) = COPY $s0
331 ; CHECK-NEXT: G_BR %bb.1
334 ; CHECK-NEXT: %copy_assert_sext:fpr(s32) = G_ASSERT_SEXT %copy, 16
335 ; CHECK-NEXT: $s1 = COPY %copy_assert_sext(s32)
336 ; CHECK-NEXT: RET_ReallyLR implicit $s1
340 %copy:_(s32) = COPY $s0
343 ; The G_ASSERT_SEXT should end up on a FPR.
344 %copy_assert_sext:_(s32) = G_ASSERT_SEXT %copy(s32), 16
345 $s1 = COPY %copy_assert_sext
346 RET_ReallyLR implicit $s1
351 name: different_blocks_fpr_backedge
354 tracksRegLiveness: true
356 ; CHECK-LABEL: name: different_blocks_fpr_backedge
358 ; CHECK-NEXT: successors: %bb.1(0x80000000)
359 ; CHECK-NEXT: liveins: $s0, $s1
361 ; CHECK-NEXT: %copy:fpr(s32) = COPY $s0
362 ; CHECK-NEXT: G_BR %bb.1
365 ; CHECK-NEXT: successors: %bb.2(0x80000000)
367 ; CHECK-NEXT: %copy_assert_sext1:fpr(s32) = G_ASSERT_SEXT %copy, 16
368 ; CHECK-NEXT: G_BR %bb.2
371 ; CHECK-NEXT: successors: %bb.0(0x80000000)
373 ; CHECK-NEXT: %copy_assert_sext2:fpr(s32) = G_ASSERT_SEXT %copy_assert_sext1, 16
374 ; CHECK-NEXT: %copy_assert_sext3:fpr(s32) = G_ASSERT_SEXT %copy_assert_sext2, 16
375 ; CHECK-NEXT: G_BR %bb.0
379 %copy:_(s32) = COPY $s0
383 ; All of the G_ASSERT_SEXTs should end up on FPRs.
384 %copy_assert_sext1:_(s32) = G_ASSERT_SEXT %copy(s32), 16
388 %copy_assert_sext2:_(s32) = G_ASSERT_SEXT %copy_assert_sext1(s32), 16
389 %copy_assert_sext3:_(s32) = G_ASSERT_SEXT %copy_assert_sext2(s32), 16