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