• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
3# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
4
5---
6name: and_s1_sgpr_sgpr
7legalized: true
8
9body: |
10  bb.0:
11    liveins: $sgpr0, $sgpr1
12    ; CHECK-LABEL: name: and_s1_sgpr_sgpr
13    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
14    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
15    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
16    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
17    ; CHECK: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
18    ; CHECK: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
19    ; CHECK: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
20    ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
21    %0:_(s32) = COPY $sgpr0
22    %1:_(s32) = COPY $sgpr1
23    %2:_(s1) = G_TRUNC %0
24    %3:_(s1) = G_TRUNC %1
25    %4:_(s1) = G_AND %2, %3
26...
27
28---
29name: and_s1_scc_scc
30legalized: true
31
32body: |
33  bb.0:
34    liveins: $sgpr0, $sgpr1
35    ; CHECK-LABEL: name: and_s1_scc_scc
36    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
37    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
38    ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
39    ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
40    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
41    ; CHECK: [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
42    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
43    ; CHECK: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
44    ; CHECK: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
45    ; CHECK: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
46    ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
47    %0:_(s32) = COPY $sgpr0
48    %1:_(s32) = COPY $sgpr1
49    %2:_(s32) = G_CONSTANT i32 0
50    %3:_(s1) = G_ICMP intpred(eq), %0, %2
51    %4:_(s1) = G_ICMP intpred(eq), %1, %2
52    %5:_(s1) = G_AND %3, %4
53...
54
55---
56name: and_s1_vgpr_vgpr
57legalized: true
58
59body: |
60  bb.0:
61    liveins: $vgpr0, $vgpr1
62    ; CHECK-LABEL: name: and_s1_vgpr_vgpr
63    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
64    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
65    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
66    ; CHECK: [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
67    ; CHECK: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
68    ; CHECK: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
69    ; CHECK: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
70    ; CHECK: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
71    %0:_(s32) = COPY $vgpr0
72    %1:_(s32) = COPY $vgpr1
73    %2:_(s1) = G_TRUNC %0
74    %3:_(s1) = G_TRUNC %1
75    %4:_(s1) = G_AND %2, %3
76...
77
78---
79name: and_s1_vcc_vcc
80legalized: true
81
82body: |
83  bb.0:
84    liveins: $vgpr0, $vgpr1
85    ; CHECK-LABEL: name: and_s1_vcc_vcc
86    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
87    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
88    ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
89    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
90    ; CHECK: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY2]]
91    ; CHECK: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
92    ; CHECK: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
93    ; CHECK: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[ICMP]], [[ICMP1]]
94    %0:_(s32) = COPY $vgpr0
95    %1:_(s32) = COPY $vgpr1
96    %2:_(s32) = G_CONSTANT i32 0
97    %3:_(s1) = G_ICMP intpred(eq), %0, %2
98    %4:_(s1) = G_ICMP intpred(eq), %1, %2
99    %5:_(s1) = G_AND %3, %4
100...
101
102---
103name: and_s1_sgpr_vgpr
104legalized: true
105
106body: |
107  bb.0:
108    liveins: $sgpr0, $vgpr0
109    ; CHECK-LABEL: name: and_s1_sgpr_vgpr
110    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
111    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
112    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
113    ; CHECK: [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
114    ; CHECK: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
115    ; CHECK: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
116    ; CHECK: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
117    ; CHECK: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
118    %0:_(s32) = COPY $sgpr0
119    %1:_(s32) = COPY $vgpr0
120    %2:_(s1) = G_TRUNC %0
121    %3:_(s1) = G_TRUNC %1
122    %4:_(s1) = G_AND %2, %3
123...
124
125---
126name: and_s1_vgpr_sgpr
127legalized: true
128
129body: |
130  bb.0:
131    liveins: $vgpr0, $vgpr0
132    ; CHECK-LABEL: name: and_s1_vgpr_sgpr
133    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
134    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
135    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
136    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
137    ; CHECK: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
138    ; CHECK: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
139    ; CHECK: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
140    ; CHECK: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
141    %0:_(s32) = COPY $vgpr0
142    %1:_(s32) = COPY $sgpr0
143    %2:_(s1) = G_TRUNC %0
144    %3:_(s1) = G_TRUNC %1
145    %4:_(s1) = G_AND %2, %3
146...
147
148# FIXME: Should just change the result bank of the scc compare.
149---
150name: and_s1_scc_vcc
151legalized: true
152
153body: |
154  bb.0:
155    liveins: $sgpr0, $vgpr0
156    ; CHECK-LABEL: name: and_s1_scc_vcc
157    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
158    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
159    ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
160    ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
161    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
162    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
163    ; CHECK: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY2]]
164    ; CHECK: [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
165    ; CHECK: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[COPY3]], [[ICMP1]]
166    %0:_(s32) = COPY $sgpr0
167    %1:_(s32) = COPY $vgpr0
168    %2:_(s32) = G_CONSTANT i32 0
169    %3:_(s1) = G_ICMP intpred(eq), %0, %2
170    %4:_(s1) = G_ICMP intpred(eq), %1, %2
171    %5:_(s1) = G_AND %3, %4
172...
173
174---
175name: and_s1_vcc_scc
176legalized: true
177
178body: |
179  bb.0:
180    liveins: $vgpr0, $vgpr1
181    ; CHECK-LABEL: name: and_s1_vcc_scc
182    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
183    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
184    ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
185    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
186    ; CHECK: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY2]]
187    ; CHECK: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
188    ; CHECK: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
189    ; CHECK: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[ICMP]], [[ICMP1]]
190    %0:_(s32) = COPY $vgpr0
191    %1:_(s32) = COPY $vgpr1
192    %2:_(s32) = G_CONSTANT i32 0
193    %3:_(s1) = G_ICMP intpred(eq), %0, %2
194    %4:_(s1) = G_ICMP intpred(eq), %1, %2
195    %5:_(s1) = G_AND %3, %4
196...
197
198
199# Test with a known result bank
200# ---
201# name: and_s1_vcc_sgpr_sgpr
202# legalized: true
203
204# body: |
205#   bb.0:
206#     liveins: $sgpr0, $sgpr1
207
208#     %0:_(s32) = COPY $sgpr0
209#     %1:_(s32) = COPY $sgpr1
210#     %2:_(s1) = G_TRUNC %0
211#     %3:_(s1) = G_TRUNC %1
212#     %4:vcc(s1) = G_AND %2, %3
213# ...
214
215# ---
216# name: and_s1_vcc_vgpr_vgpr
217# legalized: true
218
219# body: |
220#   bb.0:
221#     liveins: $vgpr0, $vgpr1
222
223#     %0:_(s32) = COPY $vgpr0
224#     %1:_(s32) = COPY $vgpr1
225#     %2:_(s1) = G_TRUNC %0
226#     %3:_(s1) = G_TRUNC %1
227#     %4:vcc(s1) = G_AND %2, %3
228# ...
229
230# ---
231# name: and_s1_vcc_vgpr_sgpr
232# legalized: true
233
234# body: |
235#   bb.0:
236#     liveins: $vgpr0, $sgpr0
237#     %0:_(s32) = COPY $vgpr0
238#     %1:_(s32) = COPY $sgpr0
239#     %2:_(s1) = G_TRUNC %0
240#     %3:_(s1) = G_TRUNC %1
241#     %4:vcc(s1) = G_AND %2, %3
242# ...
243
244# ---
245# name: and_s1_vcc_sgpr_vgpr
246# legalized: true
247
248# body: |
249#   bb.0:
250#     liveins: $vgpr0, $sgpr0
251#     %0:_(s32) = COPY $sgpr0
252#     %1:_(s32) = COPY $vgpr0
253#     %2:_(s1) = G_TRUNC %0
254#     %3:_(s1) = G_TRUNC %1
255#     %4:vcc(s1) = G_AND %2, %3
256# ...
257
258---
259name: and_s1_vgpr_sgpr_sgpr
260legalized: true
261
262body: |
263  bb.0:
264    liveins: $sgpr0, $sgpr1
265    ; CHECK-LABEL: name: and_s1_vgpr_sgpr_sgpr
266    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
267    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
268    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
269    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
270    ; CHECK: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
271    ; CHECK: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
272    ; CHECK: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
273    ; CHECK: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
274    %0:_(s32) = COPY $sgpr0
275    %1:_(s32) = COPY $sgpr1
276    %2:_(s1) = G_TRUNC %0
277    %3:_(s1) = G_TRUNC %1
278    %4:vgpr(s1) = G_AND %2, %3
279...
280
281---
282name: and_s1_sgpr_sgpr_sgpr
283legalized: true
284
285body: |
286  bb.0:
287    liveins: $sgpr0, $sgpr1
288    ; CHECK-LABEL: name: and_s1_sgpr_sgpr_sgpr
289    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
290    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
291    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
292    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
293    ; CHECK: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
294    ; CHECK: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
295    ; CHECK: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
296    ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
297    %0:_(s32) = COPY $sgpr0
298    %1:_(s32) = COPY $sgpr1
299    %2:_(s1) = G_TRUNC %0
300    %3:_(s1) = G_TRUNC %1
301    %4:sgpr(s1) = G_AND %2, %3
302...
303