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_ZEXT.
12 tracksRegLiveness: true
17 ; G_ASSERT_ZEXT should end up on a GPR.
19 ; CHECK-LABEL: name: gpr
20 ; CHECK: liveins: $w0, $w1
21 ; CHECK: %copy:gpr(s32) = COPY $w0
22 ; CHECK: %copy_assert_zext:gpr(s32) = G_ASSERT_ZEXT %copy, 16
23 ; CHECK: $w1 = COPY %copy_assert_zext(s32)
24 ; CHECK: RET_ReallyLR implicit $w1
25 %copy:_(s32) = COPY $w0
26 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
27 $w1 = COPY %copy_assert_zext(s32)
28 RET_ReallyLR implicit $w1
35 tracksRegLiveness: true
40 ; G_ASSERT_ZEXT should end up on a GPR.
42 ; CHECK-LABEL: name: gpr_vector
43 ; CHECK: liveins: $x0, $x1
44 ; CHECK: %copy:gpr(<2 x s32>) = COPY $x0
45 ; CHECK: %copy_assert_zext:gpr(<2 x s32>) = G_ASSERT_ZEXT %copy, 16
46 ; CHECK: $x1 = COPY %copy_assert_zext(<2 x s32>)
47 ; CHECK: RET_ReallyLR implicit $x1
48 %copy:_(<2 x s32>) = COPY $x0
49 %copy_assert_zext:_(<2 x s32>) = G_ASSERT_ZEXT %copy(<2 x s32>), 16
50 $x1 = COPY %copy_assert_zext(<2 x s32>)
51 RET_ReallyLR implicit $x1
58 tracksRegLiveness: true
63 ; G_ASSERT_ZEXT should end up on a FPR.
65 ; CHECK-LABEL: name: fpr
66 ; CHECK: liveins: $s0, $s1
67 ; CHECK: %copy:fpr(s32) = COPY $s0
68 ; CHECK: %copy_assert_zext:fpr(s32) = G_ASSERT_ZEXT %copy, 16
69 ; CHECK: $s1 = COPY %copy_assert_zext(s32)
70 ; CHECK: RET_ReallyLR implicit $s1
71 %copy:_(s32) = COPY $s0
72 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
73 $s1 = COPY %copy_assert_zext(s32)
74 RET_ReallyLR implicit $s1
81 tracksRegLiveness: true
86 ; G_ASSERT_ZEXT should end up on a FPR.
88 ; CHECK-LABEL: name: fpr_vector
89 ; CHECK: liveins: $d0, $d1
90 ; CHECK: %copy:fpr(<2 x s32>) = COPY $d0
91 ; CHECK: %copy_assert_zext:fpr(<2 x s32>) = G_ASSERT_ZEXT %copy, 16
92 ; CHECK: $d1 = COPY %copy_assert_zext(<2 x s32>)
93 ; CHECK: RET_ReallyLR implicit $d1
94 %copy:_(<2 x s32>) = COPY $d0
95 %copy_assert_zext:_(<2 x s32>) = G_ASSERT_ZEXT %copy(<2 x s32>), 16
96 $d1 = COPY %copy_assert_zext(<2 x s32>)
97 RET_ReallyLR implicit $d1
101 name: in_between_cross_bank_copy
104 tracksRegLiveness: true
109 ; CHECK-LABEL: name: in_between_cross_bank_copy
110 ; CHECK: liveins: $s0, $w1
111 ; CHECK: %copy:fpr(s32) = COPY $s0
112 ; CHECK: %copy_assert_zext:fpr(s32) = G_ASSERT_ZEXT %copy, 16
113 ; CHECK: $w1 = COPY %copy_assert_zext(s32)
114 ; CHECK: RET_ReallyLR implicit $w1
115 %copy:_(s32) = COPY $s0
116 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
117 $w1 = COPY %copy_assert_zext(s32)
118 RET_ReallyLR implicit $w1
122 name: fpr_feeding_store
125 tracksRegLiveness: true
128 liveins: $x0, $s0, $s1
130 ; The G_ASSERT_ZEXT should end up on a FPR, and there should be no copy
131 ; between it and the G_STORE.
133 ; CHECK-LABEL: name: fpr_feeding_store
134 ; CHECK: liveins: $x0, $s0, $s1
135 ; CHECK: %ptr:gpr(p0) = COPY $x0
136 ; CHECK: %copy:fpr(s32) = COPY $s0
137 ; CHECK: %copy_assert_zext:fpr(s32) = G_ASSERT_ZEXT %copy, 16
138 ; CHECK: G_STORE %copy_assert_zext(s32), %ptr(p0) :: (store (s32))
139 ; CHECK: RET_ReallyLR
140 %ptr:_(p0) = COPY $x0
141 %copy:_(s32) = COPY $s0
142 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
143 G_STORE %copy_assert_zext(s32), %ptr(p0) :: (store (s32))
148 name: fpr_feeding_select
151 tracksRegLiveness: true
152 machineFunctionInfo: {}
155 liveins: $d0, $x1, $w0
157 ; G_ASSERT_ZEXT and G_SELECT should both end up on FPRs.
159 ; CHECK-LABEL: name: fpr_feeding_select
160 ; CHECK: liveins: $d0, $x1, $w0
161 ; CHECK: %w0:gpr(s32) = COPY $w0
162 ; CHECK: %cond:gpr(s1) = G_TRUNC %w0(s32)
163 ; CHECK: %fpr:fpr(s64) = COPY $d0
164 ; CHECK: %fpr_assert_zext:fpr(s64) = G_ASSERT_ZEXT %fpr, 32
165 ; CHECK: %gpr:gpr(s64) = COPY $x1
166 ; CHECK: [[COPY:%[0-9]+]]:fpr(s64) = COPY %gpr(s64)
167 ; CHECK: %select:fpr(s64) = G_SELECT %cond(s1), %fpr_assert_zext, [[COPY]]
168 ; CHECK: $d0 = COPY %select(s64)
169 ; CHECK: RET_ReallyLR implicit $d0
170 %w0:_(s32) = COPY $w0
171 %cond:_(s1) = G_TRUNC %w0(s32)
172 %fpr:_(s64) = COPY $d0
173 %fpr_assert_zext:_(s64) = G_ASSERT_ZEXT %fpr, 32
174 %gpr:_(s64) = COPY $x1
175 %select:_(s64) = G_SELECT %cond(s1), %fpr_assert_zext, %gpr
176 $d0 = COPY %select(s64)
177 RET_ReallyLR implicit $d0
181 name: fpr_feeding_phi
184 tracksRegLiveness: true
186 ; CHECK-LABEL: name: fpr_feeding_phi
188 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
189 ; CHECK: liveins: $s0, $w1
190 ; CHECK: %copy1:fpr(s32) = COPY $s0
191 ; CHECK: %copy2:gpr(s32) = COPY $w1
192 ; CHECK: %copy_assert_zext:fpr(s32) = G_ASSERT_ZEXT %copy1, 16
193 ; CHECK: [[COPY:%[0-9]+]]:gpr(s32) = COPY %copy1(s32)
194 ; CHECK: %cmp:gpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), %copy2
195 ; CHECK: %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
196 ; CHECK: G_BRCOND %cmp_trunc(s1), %bb.1
199 ; CHECK: successors: %bb.2(0x80000000)
200 ; CHECK: %bb1_val:gpr(s32) = COPY %copy2(s32)
203 ; CHECK: successors: %bb.0(0x80000000)
204 ; CHECK: %phi:fpr(s32) = G_PHI %copy_assert_zext(s32), %bb.0, %bb1_val(s32), %bb.1
207 successors: %bb.1, %bb.2
209 %copy1:_(s32) = COPY $s0
210 %copy2:_(s32) = COPY $w1
212 ; This should produce a FPR.
213 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy1(s32), 16
215 %cmp:_(s32) = G_ICMP intpred(eq), %copy1, %copy2
216 %cmp_trunc:_(s1) = G_TRUNC %cmp
217 G_BRCOND %cmp_trunc, %bb.1
221 %bb1_val:_(s32) = COPY %copy2
225 ; This should produce a FPR.
226 %phi:_(s32) = G_PHI %copy_assert_zext, %bb.0, %bb1_val, %bb.1
234 tracksRegLiveness: true
236 ; CHECK-LABEL: name: fed_by_fpr_phi
238 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
239 ; CHECK: liveins: $s0, $s1
240 ; CHECK: %copy1:fpr(s32) = COPY $s0
241 ; CHECK: %copy2:fpr(s32) = COPY $s1
242 ; CHECK: [[COPY:%[0-9]+]]:gpr(s32) = COPY %copy1(s32)
243 ; CHECK: [[COPY1:%[0-9]+]]:gpr(s32) = COPY %copy2(s32)
244 ; CHECK: %cmp:gpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
245 ; CHECK: %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
246 ; CHECK: G_BRCOND %cmp_trunc(s1), %bb.1
249 ; CHECK: successors: %bb.2(0x80000000)
250 ; CHECK: %bb1_val:gpr(s32) = COPY %copy2(s32)
253 ; CHECK: successors: %bb.0(0x80000000)
254 ; CHECK: %phi:fpr(s32) = G_PHI %copy1(s32), %bb.0, %bb1_val(s32), %bb.1
255 ; CHECK: %assert_zext:fpr(s32) = G_ASSERT_ZEXT %phi, 16
258 successors: %bb.1, %bb.2
260 %copy1:_(s32) = COPY $s0
261 %copy2:_(s32) = COPY $s1
262 %cmp:_(s32) = G_ICMP intpred(eq), %copy1, %copy2
263 %cmp_trunc:_(s1) = G_TRUNC %cmp
264 G_BRCOND %cmp_trunc, %bb.1
268 %bb1_val:_(s32) = COPY %copy2
272 ; The G_PHI and G_ASSERT_ZEXT should both end up on FPRs.
273 %phi:_(s32) = G_PHI %copy1, %bb.0, %bb1_val, %bb.1
274 %assert_zext:_(s32) = G_ASSERT_ZEXT %phi(s32), 16
279 name: different_blocks_gpr
282 tracksRegLiveness: true
284 ; CHECK-LABEL: name: different_blocks_gpr
286 ; CHECK: successors: %bb.1(0x80000000)
287 ; CHECK: liveins: $w0, $w1
288 ; CHECK: %copy:gpr(s32) = COPY $w0
291 ; CHECK: %copy_assert_zext:gpr(s32) = G_ASSERT_ZEXT %copy, 16
292 ; CHECK: $w1 = COPY %copy_assert_zext(s32)
293 ; CHECK: RET_ReallyLR implicit $w1
297 %copy:_(s32) = COPY $w0
300 ; The G_ASSERT_ZEXT should end up on a GPR.
301 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
302 $w1 = COPY %copy_assert_zext
303 RET_ReallyLR implicit $w1
307 name: different_blocks_fpr
310 tracksRegLiveness: true
312 ; CHECK-LABEL: name: different_blocks_fpr
314 ; CHECK: successors: %bb.1(0x80000000)
315 ; CHECK: liveins: $s0, $s1
316 ; CHECK: %copy:fpr(s32) = COPY $s0
319 ; CHECK: %copy_assert_zext:fpr(s32) = G_ASSERT_ZEXT %copy, 16
320 ; CHECK: $s1 = COPY %copy_assert_zext(s32)
321 ; CHECK: RET_ReallyLR implicit $s1
325 %copy:_(s32) = COPY $s0
328 ; The G_ASSERT_ZEXT should end up on a FPR.
329 %copy_assert_zext:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
330 $s1 = COPY %copy_assert_zext
331 RET_ReallyLR implicit $s1
336 name: different_blocks_fpr_backedge
339 tracksRegLiveness: true
341 ; CHECK-LABEL: name: different_blocks_fpr_backedge
343 ; CHECK: successors: %bb.1(0x80000000)
344 ; CHECK: liveins: $s0, $s1
345 ; CHECK: %copy:fpr(s32) = COPY $s0
348 ; CHECK: successors: %bb.2(0x80000000)
349 ; CHECK: %copy_assert_zext1:fpr(s32) = G_ASSERT_ZEXT %copy, 16
352 ; CHECK: successors: %bb.0(0x80000000)
353 ; CHECK: %copy_assert_zext2:fpr(s32) = G_ASSERT_ZEXT %copy_assert_zext1, 16
354 ; CHECK: %copy_assert_zext3:fpr(s32) = G_ASSERT_ZEXT %copy_assert_zext2, 16
359 %copy:_(s32) = COPY $s0
363 ; All of the G_ASSERT_ZEXTs should end up on FPRs.
364 %copy_assert_zext1:_(s32) = G_ASSERT_ZEXT %copy(s32), 16
368 %copy_assert_zext2:_(s32) = G_ASSERT_ZEXT %copy_assert_zext1(s32), 16
369 %copy_assert_zext3:_(s32) = G_ASSERT_ZEXT %copy_assert_zext2(s32), 16