1 # RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN -DVCCRC=sreg_64_xexec %s
2 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN -DVCCRC=sreg_64_xexec %s
3 # RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN -DVCCRC=sreg_32_xm0_xexec %s
10 # GCN: name: icmp_s32_s_mix
11 # GCN: [[SGPR0:%[0-9]+]]:sreg_32 = COPY $sgpr0
12 # GCN: [[SGPR1:%[0-9]+]]:sreg_32 = COPY $sgpr1
13 # GCN: [[SGPR2:%[0-9]+]]:sreg_32 = COPY $sgpr2
14 # GCN: [[SGPR3:%[0-9]+]]:sreg_32 = COPY $sgpr3
15 # GCN: [[SGPR4:%[0-9]+]]:sreg_32 = COPY $sgpr4
16 # GCN: [[SGPR5:%[0-9]+]]:sreg_32 = COPY $sgpr5
17 # GCN: [[SGPR6:%[0-9]+]]:sreg_32 = COPY $sgpr6
18 # GCN: [[SGPR7:%[0-9]+]]:sreg_32 = COPY $sgpr7
19 # GCN: S_CMP_LG_U32 [[SGPR0]], [[SGPR1]], implicit-def $scc
20 # GCN-NEXT: [[COND0:%[0-9]+]]:sgpr_32 = COPY $scc
21 # GCN: S_CMP_LG_U32 [[SGPR4]], [[SGPR5]], implicit-def $scc
22 # GCN-NEXT: [[COND1:%[0-9]+]]:sgpr_32 = COPY $scc
23 # GCN: $scc = COPY [[COND0]]
24 # GCN-NEXT: S_CSELECT_B32 [[SGPR6]], [[SGPR7]], implicit $scc
25 # GCN: $scc = COPY [[COND1]]
26 # GCN-NEXT: S_CSELECT_B32 [[SGPR2]], [[SGPR3]], implicit $scc
30 liveins: $vgpr0_vgpr1, $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7
32 %0:vgpr(p1) = COPY $vgpr0_vgpr1
33 %1:sgpr(s32) = COPY $sgpr0
34 %2:sgpr(s32) = COPY $sgpr1
35 %3:sgpr(s32) = COPY $sgpr2
36 %4:sgpr(s32) = COPY $sgpr3
37 %5:sgpr(s32) = COPY $sgpr4
38 %6:sgpr(s32) = COPY $sgpr5
39 %7:sgpr(s32) = COPY $sgpr6
40 %8:sgpr(s32) = COPY $sgpr7
41 %9:scc(s1) = G_ICMP intpred(ne), %1, %2
42 %10:scc(s1) = G_ICMP intpred(ne), %5, %6
43 %11:sgpr(s32) = G_SELECT %9, %7, %8
44 %12:sgpr(s32) = G_SELECT %10, %3, %4
45 %13:vgpr(s32) = COPY %11
46 G_STORE %13, %0 :: (volatile store 4, addrspace 1)
47 %14:vgpr(s32) = COPY %12
48 G_STORE %14, %0 :: (volatile store 4, addrspace 1)
56 # GCN-LABEL: name: icmp_s32_salu
70 liveins: $vgpr0_vgpr1, $sgpr0, $sgpr1, $sgpr2, $sgpr3
72 %0:vgpr(p1) = COPY $vgpr0_vgpr1
73 %1:sgpr(s32) = COPY $sgpr0
74 %2:sgpr(s32) = COPY $sgpr1
75 %3:sgpr(s32) = COPY $sgpr2
76 %4:sgpr(s32) = COPY $sgpr3
77 %5:scc(s1) = G_ICMP intpred(ne), %1, %2
78 %6:scc(s1) = G_ICMP intpred(eq), %1, %2
79 %7:scc(s1) = G_ICMP intpred(sgt), %1, %2
80 %8:scc(s1) = G_ICMP intpred(sge), %1, %2
81 %9:scc(s1) = G_ICMP intpred(slt), %1, %2
82 %10:scc(s1) = G_ICMP intpred(sle), %1, %2
83 %11:scc(s1) = G_ICMP intpred(ugt), %1, %2
84 %12:scc(s1) = G_ICMP intpred(uge), %1, %2
85 %13:scc(s1) = G_ICMP intpred(ult), %1, %2
86 %14:scc(s1) = G_ICMP intpred(ule), %1, %2
87 %15:sgpr(s32) = G_SELECT %5, %3, %4
88 %16:sgpr(s32) = G_SELECT %6, %3, %4
89 %17:sgpr(s32) = G_SELECT %7, %3, %4
90 %18:sgpr(s32) = G_SELECT %8, %3, %4
91 %19:sgpr(s32) = G_SELECT %9, %3, %4
92 %20:sgpr(s32) = G_SELECT %10, %3, %4
93 %21:sgpr(s32) = G_SELECT %11, %3, %4
94 %22:sgpr(s32) = G_SELECT %12, %3, %4
95 %23:sgpr(s32) = G_SELECT %13, %3, %4
96 %24:sgpr(s32) = G_SELECT %14, %3, %4
97 %25:vgpr(s32) = COPY %15
98 G_STORE %25, %0 :: (volatile store 4, addrspace 1)
99 %26:vgpr(s32) = COPY %16
100 G_STORE %26, %0 :: (volatile store 4, addrspace 1)
101 %27:vgpr(s32) = COPY %17
102 G_STORE %27, %0 :: (volatile store 4, addrspace 1)
103 %28:vgpr(s32) = COPY %18
104 G_STORE %28, %0 :: (volatile store 4, addrspace 1)
105 %29:vgpr(s32) = COPY %19
106 G_STORE %29, %0 :: (volatile store 4, addrspace 1)
107 %30:vgpr(s32) = COPY %20
108 G_STORE %30, %0 :: (volatile store 4, addrspace 1)
109 %31:vgpr(s32) = COPY %21
110 G_STORE %31, %0 :: (volatile store 4, addrspace 1)
111 %32:vgpr(s32) = COPY %22
112 G_STORE %32, %0 :: (volatile store 4, addrspace 1)
113 %33:vgpr(s32) = COPY %23
114 G_STORE %33, %0 :: (volatile store 4, addrspace 1)
115 %34:vgpr(s32) = COPY %24
116 G_STORE %34, %0 :: (volatile store 4, addrspace 1)
122 regBankSelected: true
124 # GCN-LABEL: name: icmp_s32_v_mix
125 # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
126 # GCN: [[VGPR3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
127 # GCN: [[VGPR4:%[0-9]+]]:vgpr_32 = COPY $vgpr4
128 # GCN: [[VGPR5:%[0-9]+]]:vgpr_32 = COPY $vgpr5
129 # GCN: [[VGPR6:%[0-9]+]]:vgpr_32 = COPY $vgpr6
130 # GCN: [[VGPR7:%[0-9]+]]:vgpr_32 = COPY $vgpr7
131 # GCN: [[VGPR8:%[0-9]+]]:vgpr_32 = COPY $vgpr8
132 # GCN: [[VGPR9:%[0-9]+]]:vgpr_32 = COPY $vgpr9
133 # GCN: [[COND0:%[0-9]+]]:[[VCCRC]] = V_CMP_NE_U32_e64 [[VGPR2]], [[VGPR3]]
134 # GCN: [[COND1:%[0-9]+]]:[[VCCRC]] = V_CMP_NE_U32_e64 [[VGPR6]], [[VGPR7]]
135 # GCN: V_CNDMASK_B32_e64 0, [[VGPR9]], 0, [[VGPR8]], [[COND0]]
136 # GCN: V_CNDMASK_B32_e64 0, [[VGPR5]], 0, [[VGPR4]], [[COND1]]
140 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7, $vgpr8, $vgpr9
142 %0:vgpr(p1) = COPY $vgpr0_vgpr1
143 %1:vgpr(s32) = COPY $vgpr2
144 %2:vgpr(s32) = COPY $vgpr3
145 %3:vgpr(s32) = COPY $vgpr4
146 %4:vgpr(s32) = COPY $vgpr5
147 %5:vgpr(s32) = COPY $vgpr6
148 %6:vgpr(s32) = COPY $vgpr7
149 %7:vgpr(s32) = COPY $vgpr8
150 %8:vgpr(s32) = COPY $vgpr9
151 %9:vcc(s1) = G_ICMP intpred(ne), %1, %2
152 %10:vcc(s1) = G_ICMP intpred(ne), %5, %6
153 %11:vgpr(s32) = G_SELECT %9, %7, %8
154 %12:vgpr(s32) = G_SELECT %10, %3, %4
155 G_STORE %11, %0 :: (volatile store 4, addrspace 1)
156 G_STORE %12, %0 :: (volatile store 4, addrspace 1)
161 regBankSelected: true
163 # GCN-LABEL: name: icmp_s32_valu
164 # GCN: V_CMP_NE_U32_e64
165 # GCN: V_CMP_EQ_U32_e64
166 # GCN: V_CMP_GT_I32_e64
167 # GCN: V_CMP_GE_I32_e64
168 # GCN: V_CMP_LT_I32_e64
169 # GCN: V_CMP_LE_I32_e64
170 # GCN: V_CMP_GT_U32_e64
171 # GCN: V_CMP_GE_U32_e64
172 # GCN: V_CMP_LT_U32_e64
173 # GCN: V_CMP_LE_U32_e64
177 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5
179 %0:vgpr(p1) = COPY $vgpr0_vgpr1
180 %1:vgpr(s32) = COPY $vgpr2
181 %2:vgpr(s32) = COPY $vgpr3
182 %3:vgpr(s32) = COPY $vgpr4
183 %4:vgpr(s32) = COPY $vgpr5
184 %5:vcc(s1) = G_ICMP intpred(ne), %1, %2
185 %6:vcc(s1) = G_ICMP intpred(eq), %1, %2
186 %7:vcc(s1) = G_ICMP intpred(sgt), %1, %2
187 %8:vcc(s1) = G_ICMP intpred(sge), %1, %2
188 %9:vcc(s1) = G_ICMP intpred(slt), %1, %2
189 %10:vcc(s1) = G_ICMP intpred(sle), %1, %2
190 %11:vcc(s1) = G_ICMP intpred(ugt), %1, %2
191 %12:vcc(s1) = G_ICMP intpred(uge), %1, %2
192 %13:vcc(s1) = G_ICMP intpred(ult), %1, %2
193 %14:vcc(s1) = G_ICMP intpred(ule), %1, %2
194 %15:vgpr(s32) = G_SELECT %5, %3, %4
195 %16:vgpr(s32) = G_SELECT %6, %3, %4
196 %17:vgpr(s32) = G_SELECT %7, %3, %4
197 %18:vgpr(s32) = G_SELECT %8, %3, %4
198 %19:vgpr(s32) = G_SELECT %9, %3, %4
199 %20:vgpr(s32) = G_SELECT %10, %3, %4
200 %21:vgpr(s32) = G_SELECT %11, %3, %4
201 %22:vgpr(s32) = G_SELECT %12, %3, %4
202 %23:vgpr(s32) = G_SELECT %13, %3, %4
203 %24:vgpr(s32) = G_SELECT %14, %3, %4
204 G_STORE %15, %0 :: (volatile store 4, addrspace 1)
205 G_STORE %16, %0 :: (volatile store 4, addrspace 1)
206 G_STORE %17, %0 :: (volatile store 4, addrspace 1)
207 G_STORE %18, %0 :: (volatile store 4, addrspace 1)
208 G_STORE %19, %0 :: (volatile store 4, addrspace 1)
209 G_STORE %20, %0 :: (volatile store 4, addrspace 1)
210 G_STORE %21, %0 :: (volatile store 4, addrspace 1)
211 G_STORE %22, %0 :: (volatile store 4, addrspace 1)
212 G_STORE %23, %0 :: (volatile store 4, addrspace 1)
213 G_STORE %24, %0 :: (volatile store 4, addrspace 1)
219 regBankSelected: true
221 # GCN-LABEL: name: icmp_s32_vv
222 # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
223 # GCN: [[VGPR3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
224 # GCN: V_CMP_NE_U32_e64 [[VGPR2]], [[VGPR3]]
228 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5
230 %0:vgpr(p1) = COPY $vgpr0_vgpr1
231 %1:vgpr(s32) = COPY $vgpr2
232 %2:vgpr(s32) = COPY $vgpr3
233 %3:vgpr(s32) = COPY $vgpr4
234 %4:vgpr(s32) = COPY $vgpr5
235 %5:vcc(s1) = G_ICMP intpred(ne), %1, %2
236 %6:vgpr(s32) = G_SELECT %5, %3, %4
237 G_STORE %6, %0 :: (store 4, addrspace 1)
243 regBankSelected: true
245 # GCN-LABEL: name: icmp_s32_vs
246 # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
247 # GCN: [[SGPR0:%[0-9]+]]:sreg_32 = COPY $sgpr0
248 # GCN: V_CMP_NE_U32_e64 [[VGPR2]], [[SGPR0]]
252 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $sgpr0
254 %0:vgpr(p1) = COPY $vgpr0_vgpr1
255 %1:vgpr(s32) = COPY $vgpr2
256 %2:vgpr(s32) = COPY $vgpr3
257 %3:vgpr(s32) = COPY $vgpr4
258 %4:sgpr(s32) = COPY $sgpr0
259 %5:vcc(s1) = G_ICMP intpred(ne), %1, %4
260 %6:vgpr(s32) = G_SELECT %5, %2, %3
261 G_STORE %6, %0 :: (store 4, addrspace 1)
267 regBankSelected: true
269 # GCN-LABEL: name: icmp_s32_sv
270 # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
271 # GCN: [[SGPR0:%[0-9]+]]:sreg_32 = COPY $sgpr0
272 # GCN: V_CMP_NE_U32_e64 [[SGPR0]], [[VGPR2]]
276 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $sgpr0
278 %0:vgpr(p1) = COPY $vgpr0_vgpr1
279 %1:vgpr(s32) = COPY $vgpr2
280 %2:vgpr(s32) = COPY $vgpr3
281 %3:vgpr(s32) = COPY $vgpr4
282 %4:sgpr(s32) = COPY $sgpr0
283 %5:vcc(s1) = G_ICMP intpred(ne), %4, %1
284 %6:vgpr(s32) = G_SELECT %5, %2, %3
285 G_STORE %6, %0 :: (store 4, addrspace 1)
289 name: icmp_s32_or_vcc
291 regBankSelected: true
293 # GCN-LABEL: name: icmp_s32_or_vcc
294 # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
295 # GCN: [[SGPR0:%[0-9]+]]:sreg_32 = COPY $sgpr0
296 # GCN: V_CMP_NE_U32_e64 [[SGPR0]], [[VGPR2]]
300 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3, $vgpr4, $sgpr0
302 %0:vgpr(p1) = COPY $vgpr0_vgpr1
303 %1:vgpr(s32) = COPY $vgpr2
304 %2:vgpr(s32) = COPY $vgpr3
305 %3:vgpr(s32) = COPY $vgpr4
306 %4:sgpr(s32) = COPY $sgpr0
307 %5:vcc(s1) = G_ICMP intpred(ne), %4, %1
308 %6:vgpr(s32) = G_SELECT %5, %2, %3
309 G_STORE %6, %0 :: (store 4, addrspace 1)
314 name: icmp_eq_ne_p3_ss
316 regBankSelected: true
318 # GCN-LABEL: name: icmp_eq_ne_p3_ss
319 # GCN: S_CMP_EQ_U32 %0, %1, implicit-def $scc
320 # GCN: S_CMP_LG_U32 %0, %1, implicit-def $scc
324 liveins: $sgpr0, $sgpr1
326 %0:sgpr(p3) = COPY $sgpr0
327 %1:sgpr(p3) = COPY $sgpr1
328 %2:scc(s1) = G_ICMP intpred(eq), %0, %1
329 %3:scc(s1) = G_ICMP intpred(ne), %0, %1
330 %4:sgpr(s32) = G_SEXT %2
331 %5:sgpr(s32) = G_SEXT %3
332 S_ENDPGM 0, implicit %4, implicit %5
338 name: icmp_eq_ne_p3_vv
340 regBankSelected: true
342 # GCN-LABEL: name: icmp_eq_ne_p3_vv
343 # GCN: %2:[[VCCRC]] = V_CMP_EQ_U32_e64 %0, %1, implicit $exec
344 # GCN: %3:[[VCCRC]] = V_CMP_NE_U32_e64 %0, %1, implicit $exec
348 liveins: $vgpr0, $vgpr1
350 %0:vgpr(p3) = COPY $vgpr0
351 %1:vgpr(p3) = COPY $vgpr1
352 %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
353 %3:vcc(s1) = G_ICMP intpred(ne), %0, %1
354 %4:vgpr(s32) = G_SEXT %2
355 %5:vgpr(s32) = G_SEXT %3
356 S_ENDPGM 0, implicit %4, implicit %5