1 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=gcn-dpp-combine -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=GCN
4 # old is undefined: only combine when masks are fully enabled and
5 # bound_ctrl:1 is set, otherwise the result of DPP VALU op can be undefined.
6 # GCN-LABEL: name: old_is_undef
7 # GCN: %2:vgpr_32 = IMPLICIT_DEF
9 # GCN: %4:vgpr_32 = V_ADD_U32_dpp %2, %0, %1, 1, 15, 15, 1, implicit $exec
10 # GCN: %6:vgpr_32 = V_ADD_U32_e32 %5, %1, implicit $exec
11 # GCN: %8:vgpr_32 = V_ADD_U32_e32 %7, %1, implicit $exec
12 # GCN: %10:vgpr_32 = V_ADD_U32_e32 %9, %1, implicit $exec
14 # GCN: %12:vgpr_32 = V_NOT_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
15 # GCN: %14:vgpr_32 = V_NOT_B32_e32 %13, implicit $exec
16 # GCN: %16:vgpr_32 = V_NOT_B32_e32 %15, implicit $exec
17 # GCN: %18:vgpr_32 = V_NOT_B32_e32 %17, implicit $exec
19 tracksRegLiveness: true
22 liveins: $vgpr0, $vgpr1
23 %0:vgpr_32 = COPY $vgpr0
24 %1:vgpr_32 = COPY $vgpr1
25 %2:vgpr_32 = IMPLICIT_DEF
28 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
29 %4:vgpr_32 = V_ADD_U32_e32 %3, %1, implicit $exec
31 %5:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 0, implicit $exec
32 %6:vgpr_32 = V_ADD_U32_e32 %5, %1, implicit $exec
34 %7:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 1, implicit $exec
35 %8:vgpr_32 = V_ADD_U32_e32 %7, %1, implicit $exec
37 %9:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
38 %10:vgpr_32 = V_ADD_U32_e32 %9, %1, implicit $exec
41 %11:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
42 %12:vgpr_32 = V_NOT_B32_e32 %11, implicit $exec
44 %13:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 0, implicit $exec
45 %14:vgpr_32 = V_NOT_B32_e32 %13, implicit $exec
47 %15:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 1, implicit $exec
48 %16:vgpr_32 = V_NOT_B32_e32 %15, implicit $exec
50 %17:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
51 %18:vgpr_32 = V_NOT_B32_e32 %17, implicit $exec
56 # GCN-LABEL: name: old_is_0
59 # case 1: old is zero, masks are fully enabled, bound_ctrl:1 is on:
60 # the DPP mov result would be either zero ({src lane disabled}|{src lane is
61 # out of range}) or active src lane result - can combine with old = undef.
62 # undef is preffered as it makes life easier for the regalloc.
63 # GCN: [[U1:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
64 # GCN: %4:vgpr_32 = V_ADD_U32_dpp [[U1]], %0, %1, 1, 15, 15, 1, implicit $exec
66 # case 2: old is zero, masks are fully enabled, bound_ctrl:1 is off:
67 # as the DPP mov old is zero this case is no different from case 1 - combine it
68 # setting bound_ctrl:1 on for the combined DPP VALU op to make old undefined
69 # GCN: [[U2:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
70 # GCN: %6:vgpr_32 = V_ADD_U32_dpp [[U2]], %0, %1, 1, 15, 15, 1, implicit $exec
72 # case 3: masks are partialy disabled, bound_ctrl:1 is on:
73 # the DPP mov result would be either zero ({src lane disabled}|{src lane is
74 # out of range} or {the DPP mov's dest VGPR write is disabled by masks}) or
75 # active src lane result - can combine with old = src1 of the VALU op.
76 # The VALU op should have the same masks as DPP mov as they select lanes
77 # with identity value.
78 # Special case: the bound_ctrl for the combined DPP VALU op isn't important
79 # here but let's make it off to keep the combiner's logic simpler.
80 # GCN: %8:vgpr_32 = V_ADD_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
82 # case 4: masks are partialy disabled, bound_ctrl:1 is off:
83 # the DPP mov result would be either zero ({src lane disabled}|{src lane is
84 # out of range} or {the DPP mov's dest VGPR write is disabled by masks}) or
85 # active src lane result - can combine with old = src1 of the VALU op.
86 # The VALU op should have the same masks as DPP mov as they select
87 # lanes with identity value
88 # GCN: %10:vgpr_32 = V_ADD_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
92 # GCN: [[U3:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
93 # GCN: %12:vgpr_32 = V_NOT_B32_dpp [[U3]], %0, 1, 15, 15, 1, implicit $exec
95 # GCN: [[U4:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
96 # GCN: %14:vgpr_32 = V_NOT_B32_dpp [[U4]], %0, 1, 15, 15, 1, implicit $exec
97 # case 3 and 4 not appliable as there is no way to specify unchanged result
98 # for the unary VALU op
99 # GCN: %16:vgpr_32 = V_NOT_B32_e32 %15, implicit $exec
100 # GCN: %18:vgpr_32 = V_NOT_B32_e32 %17, implicit $exec
103 tracksRegLiveness: true
106 liveins: $vgpr0, $vgpr1
107 %0:vgpr_32 = COPY $vgpr0
108 %1:vgpr_32 = COPY $vgpr1
109 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
112 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
113 %4:vgpr_32 = V_ADD_U32_e32 %3, %1, implicit $exec
115 %5:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 0, implicit $exec
116 %6:vgpr_32 = V_ADD_U32_e32 %5, %1, implicit $exec
118 %7:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 1, implicit $exec
119 %8:vgpr_32 = V_ADD_U32_e32 %7, %1, implicit $exec
121 %9:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
122 %10:vgpr_32 = V_ADD_U32_e32 %9, %1, implicit $exec
125 %11:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
126 %12:vgpr_32 = V_NOT_B32_e32 %11, implicit $exec
128 %13:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 0, implicit $exec
129 %14:vgpr_32 = V_NOT_B32_e32 %13, implicit $exec
131 %15:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 1, implicit $exec
132 %16:vgpr_32 = V_NOT_B32_e32 %15, implicit $exec
134 %17:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
135 %18:vgpr_32 = V_NOT_B32_e32 %17, implicit $exec
138 # old is nonzero identity cases:
140 # old is nonzero identity, masks are fully enabled, bound_ctrl:1 is off:
141 # the DPP mov result would be either identity ({src lane disabled}|{out of
142 # range}) or src lane result - can combine with old = src1 of the VALU op
143 # The DPP VALU op should have the same masks (and bctrl) as DPP mov as they
144 # select lanes with identity value
146 # GCN-LABEL: name: nonzero_old_is_identity_masks_enabled_bctl_off
147 # GCN: %4:vgpr_32 = V_MUL_U32_U24_dpp %1, %0, %1, 1, 15, 15, 0, implicit $exec
148 # GCN: %7:vgpr_32 = V_AND_B32_dpp %1, %0, %1, 1, 15, 15, 0, implicit $exec
149 # GCN: %10:vgpr_32 = V_MAX_I32_dpp %1, %0, %1, 1, 15, 15, 0, implicit $exec
150 # GCN: %13:vgpr_32 = V_MIN_I32_dpp %1, %0, %1, 1, 15, 15, 0, implicit $exec
152 name: nonzero_old_is_identity_masks_enabled_bctl_off
153 tracksRegLiveness: true
156 liveins: $vgpr0, $vgpr1
157 %0:vgpr_32 = COPY $vgpr0
158 %1:vgpr_32 = COPY $vgpr1
160 %2:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
161 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 0, implicit $exec
162 %4:vgpr_32 = V_MUL_U32_U24_e32 %3, %1, implicit $exec
164 %5:vgpr_32 = V_MOV_B32_e32 4294967295, implicit $exec
165 %6:vgpr_32 = V_MOV_B32_dpp %5, %0, 1, 15, 15, 0, implicit $exec
166 %7:vgpr_32 = V_AND_B32_e32 %6, %1, implicit $exec
168 %8:vgpr_32 = V_MOV_B32_e32 -2147483648, implicit $exec
169 %9:vgpr_32 = V_MOV_B32_dpp %8, %0, 1, 15, 15, 0, implicit $exec
170 %10:vgpr_32 = V_MAX_I32_e32 %9, %1, implicit $exec
172 %11:vgpr_32 = V_MOV_B32_e32 2147483647, implicit $exec
173 %12:vgpr_32 = V_MOV_B32_dpp %11, %0, 1, 15, 15, 0, implicit $exec
174 %13:vgpr_32 = V_MIN_I32_e32 %12, %1, implicit $exec
177 # old is nonzero identity, masks are partially enabled, bound_ctrl:1 is off:
178 # the DPP mov result would be either identity ({src lane disabled}|{src lane is
179 # out of range} or {the DPP mov's dest VGPR write is disabled by masks}) or
180 # active src lane result - can combine with old = src1 of the VALU op.
181 # The DPP VALU op should have the same masks (and bctrl) as DPP mov as they
182 # select lanes with identity value
184 # GCN-LABEL: name: nonzero_old_is_identity_masks_partially_disabled_bctl_off
185 # GCN: %4:vgpr_32 = V_MUL_U32_U24_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
186 # GCN: %7:vgpr_32 = V_AND_B32_dpp %1, %0, %1, 1, 15, 14, 0, implicit $exec
187 # GCN: %10:vgpr_32 = V_MAX_I32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
188 # GCN: %13:vgpr_32 = V_MIN_I32_dpp %1, %0, %1, 1, 15, 14, 0, implicit $exec
190 name: nonzero_old_is_identity_masks_partially_disabled_bctl_off
191 tracksRegLiveness: true
194 liveins: $vgpr0, $vgpr1
195 %0:vgpr_32 = COPY $vgpr0
196 %1:vgpr_32 = COPY $vgpr1
198 %2:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
199 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
200 %4:vgpr_32 = V_MUL_U32_U24_e32 %3, %1, implicit $exec
202 %5:vgpr_32 = V_MOV_B32_e32 4294967295, implicit $exec
203 %6:vgpr_32 = V_MOV_B32_dpp %5, %0, 1, 15, 14, 0, implicit $exec
204 %7:vgpr_32 = V_AND_B32_e32 %6, %1, implicit $exec
206 %8:vgpr_32 = V_MOV_B32_e32 -2147483648, implicit $exec
207 %9:vgpr_32 = V_MOV_B32_dpp %8, %0, 1, 14, 15, 0, implicit $exec
208 %10:vgpr_32 = V_MAX_I32_e32 %9, %1, implicit $exec
210 %11:vgpr_32 = V_MOV_B32_e32 2147483647, implicit $exec
211 %12:vgpr_32 = V_MOV_B32_dpp %11, %0, 1, 15, 14, 0, implicit $exec
212 %13:vgpr_32 = V_MIN_I32_e32 %12, %1, implicit $exec
215 # old is nonzero identity, masks are partially enabled, bound_ctrl:1 is on:
216 # the DPP mov result may have 3 different values:
217 # 1. the active src lane result
218 # 2. 0 if the src lane is disabled|out of range
219 # 3. DPP mov's old value if the mov's dest VGPR write is disabled by masks
222 # GCN-LABEL: name: nonzero_old_is_identity_masks_partially_disabled_bctl0
223 # GCN: %4:vgpr_32 = V_MUL_U32_U24_e32 %3, %1, implicit $exec
224 # GCN: %7:vgpr_32 = V_AND_B32_e32 %6, %1, implicit $exec
225 # GCN: %10:vgpr_32 = V_MAX_I32_e32 %9, %1, implicit $exec
226 # GCN: %13:vgpr_32 = V_MIN_I32_e32 %12, %1, implicit $exec
228 name: nonzero_old_is_identity_masks_partially_disabled_bctl0
229 tracksRegLiveness: true
232 liveins: $vgpr0, $vgpr1
233 %0:vgpr_32 = COPY $vgpr0
234 %1:vgpr_32 = COPY $vgpr1
236 %2:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
237 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 1, implicit $exec
238 %4:vgpr_32 = V_MUL_U32_U24_e32 %3, %1, implicit $exec
240 %5:vgpr_32 = V_MOV_B32_e32 4294967295, implicit $exec
241 %6:vgpr_32 = V_MOV_B32_dpp %5, %0, 1, 15, 14, 1, implicit $exec
242 %7:vgpr_32 = V_AND_B32_e32 %6, %1, implicit $exec
244 %8:vgpr_32 = V_MOV_B32_e32 -2147483648, implicit $exec
245 %9:vgpr_32 = V_MOV_B32_dpp %8, %0, 1, 14, 15, 1, implicit $exec
246 %10:vgpr_32 = V_MAX_I32_e32 %9, %1, implicit $exec
248 %11:vgpr_32 = V_MOV_B32_e32 2147483647, implicit $exec
249 %12:vgpr_32 = V_MOV_B32_dpp %11, %0, 1, 15, 14, 1, implicit $exec
250 %13:vgpr_32 = V_MIN_I32_e32 %12, %1, implicit $exec
253 # when the DPP source isn't a src0 operand the operation should be commuted if possible
254 # GCN-LABEL: name: dpp_commute
255 # GCN: %4:vgpr_32 = V_MUL_U32_U24_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
256 # GCN: %7:vgpr_32 = V_AND_B32_dpp %1, %0, %1, 1, 15, 14, 0, implicit $exec
257 # GCN: %10:vgpr_32 = V_MAX_I32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
258 # GCN: %13:vgpr_32 = V_MIN_I32_dpp %1, %0, %1, 1, 15, 14, 0, implicit $exec
259 # GCN: %16:vgpr_32 = V_SUBREV_CO_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit-def $vcc, implicit $exec
260 # GCN: %19:vgpr_32 = V_ADD_CO_U32_e32 5, %18, implicit-def $vcc, implicit $exec
262 tracksRegLiveness: true
265 liveins: $vgpr0, $vgpr1
267 %0:vgpr_32 = COPY $vgpr0
268 %1:vgpr_32 = COPY $vgpr1
270 %2:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
271 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
272 %4:vgpr_32 = V_MUL_U32_U24_e32 %1, %3, implicit $exec
274 %5:vgpr_32 = V_MOV_B32_e32 4294967295, implicit $exec
275 %6:vgpr_32 = V_MOV_B32_dpp %5, %0, 1, 15, 14, 0, implicit $exec
276 %7:vgpr_32 = V_AND_B32_e32 %1, %6, implicit $exec
278 %8:vgpr_32 = V_MOV_B32_e32 -2147483648, implicit $exec
279 %9:vgpr_32 = V_MOV_B32_dpp %8, %0, 1, 14, 15, 0, implicit $exec
280 %10:vgpr_32 = V_MAX_I32_e32 %1, %9, implicit $exec
282 %11:vgpr_32 = V_MOV_B32_e32 2147483647, implicit $exec
283 %12:vgpr_32 = V_MOV_B32_dpp %11, %0, 1, 15, 14, 0, implicit $exec
284 %13:vgpr_32 = V_MIN_I32_e32 %1, %12, implicit $exec
286 %14:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
287 %15:vgpr_32 = V_MOV_B32_dpp %14, %0, 1, 14, 15, 0, implicit $exec
288 %16:vgpr_32 = V_SUB_CO_U32_e32 %1, %15, implicit-def $vcc, implicit $exec
290 ; this cannot be combined because immediate as src0 isn't commutable
291 %17:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
292 %18:vgpr_32 = V_MOV_B32_dpp %17, %0, 1, 14, 15, 0, implicit $exec
293 %19:vgpr_32 = V_ADD_CO_U32_e32 5, %18, implicit-def $vcc, implicit $exec
298 # check for floating point modifiers
299 # GCN-LABEL: name: add_f32_e64
300 # GCN: %3:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
301 # GCN: %4:vgpr_32 = V_ADD_F32_e64 0, %3, 0, %0, 0, 1, implicit $mode, implicit $exec
302 # GCN: %6:vgpr_32 = V_ADD_F32_dpp %2, 0, %1, 0, %0, 1, 15, 15, 1, implicit $mode, implicit $exec
303 # GCN: %8:vgpr_32 = V_ADD_F32_dpp %2, 1, %1, 2, %0, 1, 15, 15, 1, implicit $mode, implicit $exec
304 # GCN: %10:vgpr_32 = V_ADD_F32_e64 4, %9, 8, %0, 0, 0, implicit $mode, implicit $exec
307 tracksRegLiveness: true
310 liveins: $vgpr0, $vgpr1
312 %0:vgpr_32 = COPY $vgpr0
313 %1:vgpr_32 = COPY $vgpr1
314 %2:vgpr_32 = IMPLICIT_DEF
316 ; this shouldn't be combined as omod is set
317 %3:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
318 %4:vgpr_32 = V_ADD_F32_e64 0, %3, 0, %0, 0, 1, implicit $mode, implicit $exec
320 ; this should be combined as all modifiers are default
321 %5:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
322 %6:vgpr_32 = V_ADD_F32_e64 0, %5, 0, %0, 0, 0, implicit $mode, implicit $exec
324 ; this should be combined as modifiers other than abs|neg are default
325 %7:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
326 %8:vgpr_32 = V_ADD_F32_e64 1, %7, 2, %0, 0, 0, implicit $mode, implicit $exec
328 ; this shouldn't be combined as modifiers aren't abs|neg
329 %9:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
330 %10:vgpr_32 = V_ADD_F32_e64 4, %9, 8, %0, 0, 0, implicit $mode, implicit $exec
333 # check for e64 modifiers
334 # GCN-LABEL: name: add_u32_e64
335 # GCN: %4:vgpr_32 = V_ADD_U32_dpp %2, %0, %1, 1, 15, 15, 1, implicit $exec
336 # GCN: %6:vgpr_32 = V_ADD_U32_e64 %5, %1, 1, implicit $exec
339 tracksRegLiveness: true
342 liveins: $vgpr0, $vgpr1
344 %0:vgpr_32 = COPY $vgpr0
345 %1:vgpr_32 = COPY $vgpr1
346 %2:vgpr_32 = IMPLICIT_DEF
348 ; this should be combined as all modifiers are default
349 %3:vgpr_32 = V_MOV_B32_dpp undef %2, %0, 1, 15, 15, 1, implicit $exec
350 %4:vgpr_32 = V_ADD_U32_e64 %3, %1, 0, implicit $exec
352 ; this shouldn't be combined as clamp is set
353 %5:vgpr_32 = V_MOV_B32_dpp undef %2, %0, 1, 15, 15, 1, implicit $exec
354 %6:vgpr_32 = V_ADD_U32_e64 %5, %1, 1, implicit $exec
357 # GCN-LABEL: name: add_co_u32_e64
358 # GCN: %4:vgpr_32, %5:sreg_64_xexec = V_ADD_CO_U32_e64 %3, %1, 0, implicit $exec
361 tracksRegLiveness: true
364 liveins: $vgpr0, $vgpr1
366 %0:vgpr_32 = COPY $vgpr0
367 %1:vgpr_32 = COPY $vgpr1
368 %2:vgpr_32 = IMPLICIT_DEF
370 ; this shouldn't be combined as the carry-out is used
371 %3:vgpr_32 = V_MOV_B32_dpp undef %2, %0, 1, 15, 15, 1, implicit $exec
372 %4:vgpr_32, %5:sreg_64_xexec = V_ADD_CO_U32_e64 %3, %1, 0, implicit $exec
377 # tests on sequences of dpp consumers
378 # GCN-LABEL: name: dpp_seq
379 # GCN: %4:vgpr_32 = V_ADD_CO_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit-def $vcc, implicit $exec
380 # GCN: %5:vgpr_32 = V_SUBREV_CO_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit-def $vcc, implicit $exec
381 # GCN: %6:vgpr_32 = V_OR_B32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
383 # GCN: %7:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
386 tracksRegLiveness: true
389 liveins: $vgpr0, $vgpr1
390 %0:vgpr_32 = COPY $vgpr0
391 %1:vgpr_32 = COPY $vgpr1
392 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
394 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
395 %4:vgpr_32 = V_ADD_CO_U32_e32 %3, %1, implicit-def $vcc, implicit $exec
396 %5:vgpr_32 = V_SUB_CO_U32_e32 %1, %3, implicit-def $vcc, implicit $exec
397 %6:vgpr_32 = V_OR_B32_e32 %3, %1, implicit $exec
399 %7:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
400 %8:vgpr_32 = V_ADD_CO_U32_e32 %7, %1, implicit-def $vcc, implicit $exec
401 ; this breaks the sequence
402 %9:vgpr_32 = V_SUB_CO_U32_e32 5, %7, implicit-def $vcc, implicit $exec
405 # tests on sequences of dpp consumers followed by control flow
406 # GCN-LABEL: name: dpp_seq_cf
407 # GCN: %4:vgpr_32 = V_ADD_CO_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit-def $vcc, implicit $exec
408 # GCN: %5:vgpr_32 = V_SUBREV_CO_U32_dpp %1, %0, %1, 1, 14, 15, 0, implicit-def $vcc, implicit $exec
409 # GCN: %6:vgpr_32 = V_OR_B32_dpp %1, %0, %1, 1, 14, 15, 0, implicit $exec
412 tracksRegLiveness: true
415 successors: %bb.1, %bb.2
416 liveins: $vgpr0, $vgpr1
417 %0:vgpr_32 = COPY $vgpr0
418 %1:vgpr_32 = COPY $vgpr1
419 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
421 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 14, 15, 0, implicit $exec
422 %4:vgpr_32 = V_ADD_CO_U32_e32 %3, %1, implicit-def $vcc, implicit $exec
423 %5:vgpr_32 = V_SUB_CO_U32_e32 %1, %3, implicit-def $vcc, implicit $exec
424 %6:vgpr_32 = V_OR_B32_e32 %3, %1, implicit $exec
426 %7:sreg_64 = V_CMP_EQ_U32_e64 %5, %6, implicit $exec
427 %8:sreg_64 = SI_IF %7, %bb.2, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
434 SI_END_CF %8, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
437 # GCN-LABEL: name: old_in_diff_bb
438 # GCN: %4:vgpr_32 = V_ADD_U32_dpp %0, %1, %0, 1, 1, 1, 0, implicit $exec
441 tracksRegLiveness: true
445 liveins: $vgpr0, $vgpr1
447 %0:vgpr_32 = COPY $vgpr0
448 %1:vgpr_32 = COPY $vgpr1
449 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
453 %3:vgpr_32 = V_MOV_B32_dpp %2, %1, 1, 1, 1, 0, implicit $exec
454 %4:vgpr_32 = V_ADD_U32_e32 %3, %0, implicit $exec
457 # old reg def is in diff BB but bound_ctrl:1 - can combine
458 # GCN-LABEL: name: old_in_diff_bb_bctrl_zero
459 # GCN: %4:vgpr_32 = V_ADD_U32_dpp {{%[0-9]}}, %0, %1, 1, 15, 15, 1, implicit $exec
461 name: old_in_diff_bb_bctrl_zero
462 tracksRegLiveness: true
466 liveins: $vgpr0, $vgpr1
468 %0:vgpr_32 = COPY $vgpr0
469 %1:vgpr_32 = COPY $vgpr1
470 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
474 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
475 %4:vgpr_32 = V_ADD_U32_e32 %3, %1, implicit $exec
478 # EXEC mask changed between def and use - cannot combine
479 # GCN-LABEL: name: exec_changed
480 # GCN: %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
483 tracksRegLiveness: true
486 liveins: $vgpr0, $vgpr1
488 %0:vgpr_32 = COPY $vgpr0
489 %1:vgpr_32 = COPY $vgpr1
490 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
491 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
492 %4:vgpr_32 = V_ADD_U32_e32 %3, %1, implicit $exec
493 %5:sreg_64 = COPY $exec, implicit-def $exec
494 %6:vgpr_32 = V_ADD_U32_e32 %3, %1, implicit $exec
497 # test if $old definition is correctly tracked through subreg manipulation pseudos
499 # GCN-LABEL: name: mul_old_subreg
500 # GCN: %7:vgpr_32 = V_MUL_I32_I24_dpp %0.sub1, %1, %0.sub1, 1, 1, 1, 0, implicit $exec
503 tracksRegLiveness: true
506 liveins: $vgpr0, $vgpr1
508 %0:vreg_64 = COPY $vgpr0
509 %1:vgpr_32 = COPY $vgpr1
510 %2:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
511 %3:vgpr_32 = V_MOV_B32_e32 42, implicit $exec
512 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
513 %5:vreg_64 = INSERT_SUBREG %4, %1, %subreg.sub1 ; %5.sub0 is taken from %4
514 %6:vgpr_32 = V_MOV_B32_dpp %5.sub0, %1, 1, 1, 1, 0, implicit $exec
515 %7:vgpr_32 = V_MUL_I32_I24_e32 %6, %0.sub1, implicit $exec
518 # GCN-LABEL: name: add_old_subreg
519 # GCN: %5:vgpr_32 = V_ADD_U32_dpp %0.sub1, %1, %0.sub1, 1, 1, 1, 0, implicit $exec
522 tracksRegLiveness: true
525 liveins: $vgpr0, $vgpr1
527 %0:vreg_64 = COPY $vgpr0
528 %1:vgpr_32 = COPY $vgpr1
529 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
530 %3:vreg_64 = INSERT_SUBREG %0, %2, %subreg.sub1 ; %3.sub1 is inserted
531 %4:vgpr_32 = V_MOV_B32_dpp %3.sub1, %1, 1, 1, 1, 0, implicit $exec
532 %5:vgpr_32 = V_ADD_U32_e32 %4, %0.sub1, implicit $exec
535 # GCN-LABEL: name: add_old_subreg_undef
536 # GCN: %5:vgpr_32 = V_ADD_U32_dpp undef %3.sub1, %1, %0.sub1, 1, 15, 15, 1, implicit $exec
538 name: add_old_subreg_undef
539 tracksRegLiveness: true
542 liveins: $vgpr0, $vgpr1
544 %0:vreg_64 = COPY $vgpr0
545 %1:vgpr_32 = COPY $vgpr1
546 %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
547 %3:vreg_64 = REG_SEQUENCE %2, %subreg.sub0 ; %3.sub1 is undef
548 %4:vgpr_32 = V_MOV_B32_dpp %3.sub1, %1, 1, 15, 15, 1, implicit $exec
549 %5:vgpr_32 = V_ADD_U32_e32 %4, %0.sub1, implicit $exec
552 # Test instruction which does not have modifiers in VOP1 form but does in DPP form.
553 # GCN-LABEL: name: dpp_vop1
554 # GCN: %3:vgpr_32 = V_CEIL_F32_dpp %0, 0, undef %2:vgpr_32, 1, 15, 15, 1, implicit $mode, implicit $exec
556 tracksRegLiveness: true
559 %1:vgpr_32 = IMPLICIT_DEF
560 %2:vgpr_32 = V_MOV_B32_dpp %1:vgpr_32, undef %0:vgpr_32, 1, 15, 15, 1, implicit $exec
561 %3:vgpr_32 = V_CEIL_F32_e32 %2, implicit $mode, implicit $exec
564 # Test instruction which does not have modifiers in VOP2 form but does in DPP form.
565 # GCN-LABEL: name: dpp_min
566 # GCN: %3:vgpr_32 = V_MIN_F32_dpp %0, 0, undef %2:vgpr_32, 0, undef %4:vgpr_32, 1, 15, 15, 1, implicit $mode, implicit $exec
568 tracksRegLiveness: true
571 %1:vgpr_32 = IMPLICIT_DEF
572 %2:vgpr_32 = V_MOV_B32_dpp %1:vgpr_32, undef %0:vgpr_32, 1, 15, 15, 1, implicit $exec
573 %4:vgpr_32 = V_MIN_F32_e32 %2, undef %3:vgpr_32, implicit $mode, implicit $exec
576 # Test an undef old operand
577 # GCN-LABEL: name: dpp_undef_old
578 # GCN: %3:vgpr_32 = V_CEIL_F32_dpp undef %1:vgpr_32, 0, undef %2:vgpr_32, 1, 15, 15, 1, implicit $mode, implicit $exec
580 tracksRegLiveness: true
583 %2:vgpr_32 = V_MOV_B32_dpp undef %1:vgpr_32, undef %0:vgpr_32, 1, 15, 15, 1, implicit $exec
584 %3:vgpr_32 = V_CEIL_F32_e32 %2, implicit $mode, implicit $exec
587 # Do not combine a dpp mov which writes a physreg.
588 # GCN-LABEL: name: phys_dpp_mov_dst
589 # GCN: $vgpr0 = V_MOV_B32_dpp undef %0:vgpr_32, undef %1:vgpr_32, 1, 15, 15, 1, implicit $exec
590 # GCN: %2:vgpr_32 = V_CEIL_F32_e32 $vgpr0, implicit $mode, implicit $exec
591 name: phys_dpp_mov_dst
592 tracksRegLiveness: true
595 $vgpr0 = V_MOV_B32_dpp undef %1:vgpr_32, undef %0:vgpr_32, 1, 15, 15, 1, implicit $exec
596 %2:vgpr_32 = V_CEIL_F32_e32 $vgpr0, implicit $mode, implicit $exec
599 # Do not combine a dpp mov which reads a physreg.
600 # GCN-LABEL: name: phys_dpp_mov_old_src
601 # GCN: %0:vgpr_32 = V_MOV_B32_dpp undef $vgpr0, undef %1:vgpr_32, 1, 15, 15, 1, implicit $exec
602 # GCN: %2:vgpr_32 = V_CEIL_F32_e32 %0, implicit $mode, implicit $exec
603 name: phys_dpp_mov_old_src
604 tracksRegLiveness: true
607 %1:vgpr_32 = V_MOV_B32_dpp undef $vgpr0, undef %0:vgpr_32, 1, 15, 15, 1, implicit $exec
608 %2:vgpr_32 = V_CEIL_F32_e32 %1, implicit $mode, implicit $exec
611 # Do not combine a dpp mov which reads a physreg.
612 # GCN-LABEL: name: phys_dpp_mov_src
613 # GCN: %0:vgpr_32 = V_MOV_B32_dpp undef %1:vgpr_32, undef $vgpr0, 1, 15, 15, 1, implicit $exec
614 # GCN: %2:vgpr_32 = V_CEIL_F32_e32 %0, implicit $mode, implicit $exec
615 name: phys_dpp_mov_src
616 tracksRegLiveness: true
619 %1:vgpr_32 = V_MOV_B32_dpp undef %0:vgpr_32, undef $vgpr0, 1, 15, 15, 1, implicit $exec
620 %2:vgpr_32 = V_CEIL_F32_e32 %1, implicit $mode, implicit $exec
623 # GCN-LABEL: name: dpp_reg_sequence_both_combined
624 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
625 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
626 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
627 # GCN: %9:vgpr_32 = IMPLICIT_DEF
628 # GCN: %8:vgpr_32 = IMPLICIT_DEF
629 # GCN: %6:vgpr_32 = V_ADD_CO_U32_dpp %9, %1.sub0, %2, 1, 15, 15, 1, implicit-def $vcc, implicit $exec
630 # GCN: %7:vgpr_32 = V_ADDC_U32_dpp %8, %1.sub1, %2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
631 name: dpp_reg_sequence_both_combined
632 tracksRegLiveness: true
635 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
637 %0:vreg_64 = COPY $vgpr0_vgpr1
638 %1:vreg_64 = COPY $vgpr2_vgpr3
639 %5:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
640 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
641 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
642 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
643 %6:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %5, implicit-def $vcc, implicit $exec
644 %7:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %5, implicit-def $vcc, implicit $vcc, implicit $exec
647 # GCN-LABEL: name: dpp_reg_sequence_first_combined
648 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
649 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
650 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
651 # GCN: %8:vgpr_32 = IMPLICIT_DEF
652 # GCN: %4:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 1, 1, 1, implicit $exec
653 # GCN: %5:vreg_64 = REG_SEQUENCE undef %3:vgpr_32, %subreg.sub0, %4, %subreg.sub1
654 # GCN: %6:vgpr_32 = V_ADD_CO_U32_dpp %8, %1.sub0, %2, 1, 15, 15, 1, implicit-def $vcc, implicit $exec
655 # GCN: %7:vgpr_32 = V_ADDC_U32_e32 %5.sub1, %2, implicit-def $vcc, implicit $vcc, implicit $exec
656 name: dpp_reg_sequence_first_combined
657 tracksRegLiveness: true
660 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
662 %0:vreg_64 = COPY $vgpr0_vgpr1
663 %1:vreg_64 = COPY $vgpr2_vgpr3
664 %5:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
665 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
666 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 1, 1, 1, implicit $exec
667 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
668 %6:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %5, implicit-def $vcc, implicit $exec
669 %7:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %5, implicit-def $vcc, implicit $vcc, implicit $exec
672 # GCN-LABEL: name: dpp_reg_sequence_second_combined
673 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
674 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
675 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
676 # GCN: %3:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 1, 1, 1, implicit $exec
677 # GCN: %8:vgpr_32 = IMPLICIT_DEF
678 # GCN: %5:vreg_64 = REG_SEQUENCE %3, %subreg.sub0, undef %4:vgpr_32, %subreg.sub1
679 # GCN: %6:vgpr_32 = V_ADD_CO_U32_e32 %5.sub0, %2, implicit-def $vcc, implicit $exec
680 # GCN: %7:vgpr_32 = V_ADDC_U32_dpp %8, %1.sub1, %2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
681 name: dpp_reg_sequence_second_combined
682 tracksRegLiveness: true
685 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
687 %0:vreg_64 = COPY $vgpr0_vgpr1
688 %1:vreg_64 = COPY $vgpr2_vgpr3
689 %5:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
690 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 1, 1, 1, implicit $exec
691 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
692 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
693 %6:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %5, implicit-def $vcc, implicit $exec
694 %7:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %5, implicit-def $vcc, implicit $vcc, implicit $exec
697 # GCN-LABEL: name: dpp_reg_sequence_none_combined
698 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
699 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
700 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
701 # GCN: %3:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 1, 1, 1, implicit $exec
702 # GCN: %4:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 1, 1, 1, implicit $exec
703 # GCN: %5:vreg_64 = REG_SEQUENCE %3, %subreg.sub0, %4, %subreg.sub1
704 # GCN: %6:vgpr_32 = V_ADD_CO_U32_e32 %5.sub0, %2, implicit-def $vcc, implicit $exec
705 # GCN: %7:vgpr_32 = V_ADDC_U32_e32 %5.sub1, %2, implicit-def $vcc, implicit $vcc, implicit $exec
706 name: dpp_reg_sequence_none_combined
707 tracksRegLiveness: true
710 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
712 %0:vreg_64 = COPY $vgpr0_vgpr1
713 %1:vreg_64 = COPY $vgpr2_vgpr3
714 %5:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
715 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 1, 1, 1, implicit $exec
716 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 1, 1, 1, implicit $exec
717 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
718 %6:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %5, implicit-def $vcc, implicit $exec
719 %7:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %5, implicit-def $vcc, implicit $vcc, implicit $exec
722 # GCN-LABEL: name: dpp_reg_sequence_exec_changed
723 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
724 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
725 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
726 # GCN: %3:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
727 # GCN: %4:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
728 # GCN: %5:vreg_64 = REG_SEQUENCE %3, %subreg.sub0, %4, %subreg.sub1
729 # GCN: S_BRANCH %bb.1
731 # GCN: %6:vgpr_32 = V_ADD_CO_U32_e32 %5.sub0, %2, implicit-def $vcc, implicit $exec
732 # GCN: %7:vgpr_32 = V_ADDC_U32_e32 %5.sub1, %2, implicit-def $vcc, implicit $vcc, implicit $exec
733 name: dpp_reg_sequence_exec_changed
734 tracksRegLiveness: true
737 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
739 %0:vreg_64 = COPY $vgpr0_vgpr1
740 %1:vreg_64 = COPY $vgpr2_vgpr3
741 %5:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
742 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
743 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
744 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
748 %6:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %5, implicit-def $vcc, implicit $exec
749 %7:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %5, implicit-def $vcc, implicit $vcc, implicit $exec
752 # GCN-LABEL: name: dpp_reg_sequence_subreg
753 # GCN: %0:vreg_64 = COPY $vgpr0_vgpr1
754 # GCN: %1:vreg_64 = COPY $vgpr2_vgpr3
755 # GCN: %2:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
756 # GCN: %3:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
757 # GCN: %4:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
758 # GCN: %5:vreg_64 = REG_SEQUENCE %3, %subreg.sub0, %4, %subreg.sub1
759 # GCN: %6:vreg_64 = REG_SEQUENCE %5.sub0, %subreg.sub0, %5.sub1, %subreg.sub1
760 # GCN: %7:vgpr_32 = V_ADD_CO_U32_e32 %6.sub0, %2, implicit-def $vcc, implicit $exec
761 # GCN: %8:vgpr_32 = V_ADDC_U32_e32 %6.sub1, %2, implicit-def $vcc, implicit $vcc, implicit $exec
762 name: dpp_reg_sequence_subreg
763 tracksRegLiveness: true
766 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
768 %0:vreg_64 = COPY $vgpr0_vgpr1
769 %1:vreg_64 = COPY $vgpr2_vgpr3
770 %8:vgpr_32 = V_MOV_B32_e32 5, implicit $exec
771 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
772 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
773 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
774 %5:vreg_64 = REG_SEQUENCE %4.sub0, %subreg.sub0, %4.sub1, %subreg.sub1
775 %6:vgpr_32 = V_ADD_CO_U32_e32 %5.sub0, %8, implicit-def $vcc, implicit $exec
776 %7:vgpr_32 = V_ADDC_U32_e32 %5.sub1, %8, implicit-def $vcc, implicit $vcc, implicit $exec
779 # GCN-LABEL: name: dpp64_add64_impdef
780 # GCN: %3:vgpr_32 = V_ADD_CO_U32_dpp %1.sub0, %0.sub0, undef %4:vgpr_32, 1, 15, 15, 1, implicit-def $vcc, implicit $exec
781 # GCN: %5:vgpr_32 = V_ADDC_U32_dpp %1.sub1, %0.sub1, undef %4:vgpr_32, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
782 name: dpp64_add64_impdef
783 tracksRegLiveness: true
786 %0:vreg_64 = IMPLICIT_DEF
787 %1:vreg_64 = IMPLICIT_DEF
788 %2:vreg_64 = V_MOV_B64_DPP_PSEUDO %1:vreg_64, %0:vreg_64, 1, 15, 15, 1, implicit $exec
789 %5:vgpr_32 = V_ADD_CO_U32_e32 %2.sub0, undef %4:vgpr_32, implicit-def $vcc, implicit $exec
790 %6:vgpr_32 = V_ADDC_U32_e32 %2.sub1, undef %4, implicit-def $vcc, implicit $vcc, implicit $exec
793 # GCN-LABEL: name: dpp64_add64_undef
794 # GCN: %3:vgpr_32 = V_ADD_CO_U32_dpp undef %1.sub0:vreg_64, undef %2.sub0:vreg_64, undef %4:vgpr_32, 1, 15, 15, 1, implicit-def $vcc, implicit $exec
795 # GCN: %5:vgpr_32 = V_ADDC_U32_dpp undef %1.sub1:vreg_64, undef %2.sub1:vreg_64, undef %4:vgpr_32, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
796 name: dpp64_add64_undef
797 tracksRegLiveness: true
800 %2:vreg_64 = V_MOV_B64_DPP_PSEUDO undef %1:vreg_64, undef %0:vreg_64, 1, 15, 15, 1, implicit $exec
801 %5:vgpr_32 = V_ADD_CO_U32_e32 %2.sub0, undef %4:vgpr_32, implicit-def $vcc, implicit $exec
802 %6:vgpr_32 = V_ADDC_U32_e32 %2.sub1, undef %4, implicit-def $vcc, implicit $vcc, implicit $exec
805 # GCN-LABEL: name: dpp64_add64_first_combined
806 # GCN: %8:vgpr_32 = V_MOV_B32_dpp undef %1.sub1:vreg_64, undef %2.sub1:vreg_64, 1, 15, 15, 1, implicit $exec
807 # GCN: %0:vreg_64 = REG_SEQUENCE undef %7:vgpr_32, %subreg.sub0, %8, %subreg.sub1
808 # GCN: %3:vgpr_32 = V_ADD_CO_U32_dpp undef %1.sub0:vreg_64, undef %2.sub0:vreg_64, undef %4:vgpr_32, 1, 15, 15, 1, implicit-def $vcc, implicit $exec
809 # GCN: %5:vgpr_32, dead %6:sreg_64_xexec = V_ADDC_U32_e64 1, %0.sub1, undef $vcc, 0, implicit $exec
810 name: dpp64_add64_first_combined
811 tracksRegLiveness: true
814 %2:vreg_64 = V_MOV_B64_DPP_PSEUDO undef %1:vreg_64, undef %0:vreg_64, 1, 15, 15, 1, implicit $exec
815 %4:vgpr_32 = V_ADD_CO_U32_e32 %2.sub0, undef %3:vgpr_32, implicit-def $vcc, implicit $exec
816 %5:vgpr_32, dead %6:sreg_64_xexec = V_ADDC_U32_e64 1, %2.sub1, undef $vcc, 0, implicit $exec
819 # GCN-LABEL: name: dont_combine_cndmask_with_src2
820 # GCN: %5:vgpr_32 = V_CNDMASK_B32_e64 0, %3, 0, %1, %4, implicit $exec
821 name: dont_combine_cndmask_with_src2
822 tracksRegLiveness: true
825 liveins: $vgpr0, $vgpr1
826 %0:vgpr_32 = COPY $vgpr0
827 %1:vgpr_32 = COPY $vgpr1
828 %2:vgpr_32 = IMPLICIT_DEF
830 %3:vgpr_32 = V_MOV_B32_dpp %2, %0, 1, 15, 15, 1, implicit $exec
831 %4:sreg_64_xexec = IMPLICIT_DEF
832 %5:vgpr_32 = V_CNDMASK_B32_e64 0, %3, 0, %1, %4, implicit $exec
837 # Make sure flags aren't dropped
838 # GCN-LABEL: name: flags_add_f32_e64
839 # GCN: %4:vgpr_32 = nnan nofpexcept V_ADD_F32_dpp %2, 0, %1, 0, %0, 1, 15, 15, 1, implicit $mode, implicit $exec
840 name: flags_add_f32_e64
841 tracksRegLiveness: true
844 liveins: $vgpr0, $vgpr1
846 %0:vgpr_32 = COPY $vgpr0
847 %1:vgpr_32 = COPY $vgpr1
848 %2:vgpr_32 = IMPLICIT_DEF
850 %3:vgpr_32 = V_MOV_B32_dpp undef %2, %1, 1, 15, 15, 1, implicit $exec
851 %4:vgpr_32 = nofpexcept nnan V_ADD_F32_e64 0, %3, 0, %0, 0, 0, implicit $mode, implicit $exec
852 S_ENDPGM 0, implicit %4
856 # GCN-LABEL: name: dont_combine_more_than_one_operand
857 # GCN: %3:vgpr_32 = V_MAX_F32_e64 0, %2, 0, %2, 0, 0, implicit $mode, implicit $exec
858 name: dont_combine_more_than_one_operand
859 tracksRegLiveness: true
862 liveins: $vgpr0, $vgpr1
863 %0:vgpr_32 = COPY $vgpr0
864 %1:vgpr_32 = COPY $vgpr1
865 %2:vgpr_32 = V_MOV_B32_dpp %0, %1, 1, 15, 15, 1, implicit $exec
866 %3:vgpr_32 = V_MAX_F32_e64 0, %2, 0, %2, 0, 0, implicit $mode, implicit $exec
869 # GCN-LABEL: name: dont_combine_more_than_one_operand_dpp_reg_sequence
870 # GCN: %5:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %4.sub0, implicit-def $vcc, implicit $exec
871 # GCN: %6:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %4.sub1, implicit-def $vcc, implicit $vcc, implicit $exec
872 name: dont_combine_more_than_one_operand_dpp_reg_sequence
873 tracksRegLiveness: true
876 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
877 %0:vreg_64 = COPY $vgpr0_vgpr1
878 %1:vreg_64 = COPY $vgpr2_vgpr3
879 %2:vgpr_32 = V_MOV_B32_dpp %0.sub0, %1.sub0, 1, 15, 15, 1, implicit $exec
880 %3:vgpr_32 = V_MOV_B32_dpp %0.sub1, %1.sub1, 1, 15, 15, 1, implicit $exec
881 %4:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %3, %subreg.sub1
882 %5:vgpr_32 = V_ADD_CO_U32_e32 %4.sub0, %4.sub0, implicit-def $vcc, implicit $exec
883 %6:vgpr_32 = V_ADDC_U32_e32 %4.sub1, %4.sub1, implicit-def $vcc, implicit $vcc, implicit $exec
886 # execMayBeModifiedBeforeAnyUse used to assert if the queried
887 # V_MOV_B32_dpp was the last instruction in the block.
889 name: mov_dpp_last_block_inst
890 tracksRegLiveness: true
892 ; GCN-LABEL: name: mov_dpp_last_block_inst
894 ; GCN-NEXT: successors: %bb.1(0x80000000)
895 ; GCN-NEXT: liveins: $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8
897 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr8
898 ; GCN-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
899 ; GCN-NEXT: [[DEF1:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
900 ; GCN-NEXT: [[DEF2:%[0-9]+]]:sreg_64_xexec = IMPLICIT_DEF
903 ; GCN-NEXT: successors: %bb.2(0x80000000)
905 ; GCN-NEXT: [[PHI:%[0-9]+]]:vgpr_32 = PHI [[DEF]], %bb.0, %5, %bb.2
906 ; GCN-NEXT: [[V_MOV_B32_dpp:%[0-9]+]]:vgpr_32 = V_MOV_B32_dpp [[DEF]], [[PHI]], 323, 15, 15, 0, implicit $exec
909 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.3(0x40000000)
911 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, [[DEF2]], implicit $exec
912 ; GCN-NEXT: V_CMP_NE_U32_e32 1, [[V_CNDMASK_B32_e64_]], implicit-def $vcc, implicit $exec
913 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
914 ; GCN-NEXT: S_BRANCH %bb.3
917 ; GCN-NEXT: S_ENDPGM 0
919 liveins: $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8
921 %0:sgpr_32 = COPY $sgpr8
922 %1:vgpr_32 = IMPLICIT_DEF
923 %2:sreg_32 = IMPLICIT_DEF
924 %3:sreg_64_xexec = IMPLICIT_DEF
927 %4:vgpr_32 = PHI %1, %bb.0, %5, %bb.2
928 %5:vgpr_32 = V_MOV_B32_dpp %1, %4, 323, 15, 15, 0, implicit $exec
931 %6:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %3, implicit $exec
932 V_CMP_NE_U32_e32 1, %6, implicit-def $vcc, implicit $exec
933 S_CBRANCH_VCCNZ %bb.1, implicit $vcc