1 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 -start-before=machine-scheduler -stop-after=virtregrewriter,0 -o - %s | FileCheck %s
4 # If optimize-exec-mask-pre-ra over approximates live intervals (not replicating splits)
5 # then this triggers a register allocation failure.
7 # CHECK-LABEL: name: test
11 tracksRegLiveness: true
13 - { id: 0, class: sreg_32, preferred-register: '$vcc_lo' }
14 - { id: 1, class: sreg_32, preferred-register: '$vcc_lo' }
15 - { id: 2, class: sreg_32_xm0_xexec, preferred-register: '$vcc_lo' }
17 - { reg: '$sgpr4_sgpr5', virtual-reg: '%3' }
20 scratchRSrcReg: '$sgpr100_sgpr101_sgpr102_sgpr103'
21 stackPtrOffsetReg: '$sgpr32'
24 liveins: $vgpr0, $sgpr4_sgpr5
26 %3:sgpr_64 = COPY $sgpr4_sgpr5
27 %4:vgpr_32 = COPY $vgpr0
28 %5:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 16, 0
29 S_BITCMP1_B32 %5, 0, implicit-def $scc
30 %6:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
31 %7:sreg_32 = S_MOV_B32 -1
32 %8:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 136, 0
33 S_CBRANCH_SCC1 %bb.2, implicit undef $scc
37 %9:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 8, 0
38 %10:sgpr_128 = S_LOAD_DWORDX4_IMM %3, 24, 0
39 %11:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 40, 0
40 %12:sgpr_128 = S_LOAD_DWORDX4_IMM %3, 48, 0
41 %13:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 64, 0
42 S_BITCMP1_B32 %11, 0, implicit-def $scc
43 %14:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
44 S_BITCMP1_B32 %13, 0, implicit-def $scc
45 %15:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
46 S_BITCMP1_B32 %13, 8, implicit-def $scc
47 %2:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
48 %16:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 72, 0
49 %17:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 80, 0
50 S_BITCMP1_B32 %17, 0, implicit-def $scc
51 %18:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
52 S_BITCMP1_B32 %17, 8, implicit-def $scc
53 %19:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
54 %20:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 88, 0
55 %21:sgpr_128 = S_LOAD_DWORDX4_IMM %3, 104, 0
56 %22:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 120, 0
57 S_BITCMP1_B32 %22, 0, implicit-def $scc
58 %23:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
59 %24:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 128, 0
60 %25:sreg_64 = S_MOV_B64 0
61 %26:sreg_64_xexec = S_LOAD_DWORDX2_IMM %25, 0, 0
62 %27:sreg_64 = S_MOV_B64_IMM_PSEUDO 4652218415073722368
63 %28:vreg_64 = V_MOV_B64_PSEUDO 0, implicit $exec
64 %29:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %14, implicit $exec
65 %30:sreg_64 = S_MOV_B64_IMM_PSEUDO 4358002977218854975
66 undef %31.sub1:sreg_64 = S_MOV_B32 -1064252416
67 %32:sreg_32 = S_OR_B32 %19, %18, implicit-def dead $scc
68 undef %33.sub1:sreg_64 = S_MOV_B32 2146435072
69 %34:sreg_64 = S_MOV_B64_IMM_PSEUDO 4592094252754343337
70 %35:sreg_64 = S_MOV_B64_IMM_PSEUDO 4593089322246397463
71 %36:sreg_64 = S_MOV_B64_IMM_PSEUDO 4593150332132823898
72 %37:sreg_64 = S_MOV_B64_IMM_PSEUDO 4593971714784152002
73 %38:sreg_64 = S_MOV_B64_IMM_PSEUDO 4594710915293070409
74 %39:sreg_64 = S_MOV_B64_IMM_PSEUDO 4595718710613720112
75 %40:sreg_64 = S_MOV_B64_IMM_PSEUDO 4597174419628462798
76 %41:sreg_64 = S_MOV_B64_IMM_PSEUDO 4598818590920614106
77 %42:sreg_64 = S_MOV_B64_IMM_PSEUDO 4600877379321698716
78 %43:sreg_64 = S_MOV_B64_IMM_PSEUDO 4604180019048437077
79 undef %44.sub1:sreg_64 = S_MOV_B32 -1075489451
80 %45:sreg_64 = S_MOV_B64_IMM_PSEUDO 4609176140021203710
81 undef %46.sub1:sreg_64 = S_MOV_B32 -1132807010
82 %47:sreg_64 = S_MOV_B64_IMM_PSEUDO 4508818957471820556
83 %48:sreg_64 = S_MOV_B64_IMM_PSEUDO 4493147761815702327
84 %49:sreg_64 = S_MOV_B64_IMM_PSEUDO 4523617260404727396
85 %50:sreg_64 = S_MOV_B64_IMM_PSEUDO 4537941333260232368
86 %51:sreg_64 = S_MOV_B64_IMM_PSEUDO 4551452160460988270
87 %52:sreg_64 = S_MOV_B64_IMM_PSEUDO 4564047942395279280
88 %53:sreg_64 = S_MOV_B64_IMM_PSEUDO 4575957461383652130
89 %54:sreg_64 = S_MOV_B64_IMM_PSEUDO 4586165620538933921
90 %55:sreg_64 = S_MOV_B64_IMM_PSEUDO 4595172819793696017
91 %56:sreg_64 = S_MOV_B64_IMM_PSEUDO 4602678819172646923
92 undef %57.sub1:sreg_64 = S_MOV_B32 -1101341163
93 %7:sreg_32 = IMPLICIT_DEF
94 %58:sreg_32 = IMPLICIT_DEF
95 %59:sreg_32 = COPY %27.sub0
96 %60:vreg_64 = COPY %28
97 %61:vreg_64 = COPY %28
98 %62:vreg_64 = COPY %28
99 %63:vreg_64 = COPY %28
100 %64:vreg_64 = COPY %28
104 %65:sreg_32 = COPY $exec_lo, implicit-def $exec_lo
105 %66:sreg_32 = S_AND_B32 %65, %7, implicit-def dead $scc
106 $exec_lo = S_MOV_B32_term %66
107 S_CBRANCH_EXECZ %bb.18, implicit $exec
111 %67:sreg_32 = S_AND_B32 $exec_lo, %6, implicit-def dead $scc
113 %58:sreg_32 = S_OR_B32 %58, $exec_lo, implicit-def dead $scc
114 S_CBRANCH_VCCNZ %bb.7, implicit killed $vcc
117 %64:vreg_64 = IMPLICIT_DEF
118 %63:vreg_64 = IMPLICIT_DEF
119 %62:vreg_64 = IMPLICIT_DEF
120 %61:vreg_64 = IMPLICIT_DEF
121 %60:vreg_64 = IMPLICIT_DEF
122 %28:vreg_64 = IMPLICIT_DEF
123 %68:sreg_32 = S_MOV_B32 -1
127 S_CBRANCH_SCC1 %bb.18, implicit undef $scc
130 %69:sreg_32_xm0_xexec = S_XOR_B32 %6, -1, implicit-def dead $scc
131 %70:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 96, 0
132 S_BITCMP1_B32 %70, 0, implicit-def $scc
133 %71:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
134 S_BITCMP1_B32 %8.sub1, 0, implicit-def $scc
135 %72:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
136 %73:sreg_32_xm0_xexec = S_XOR_B32 %72, -1, implicit-def dead $scc
137 %74:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %73, implicit $exec
138 %75:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %71, implicit $exec
139 %76:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %69, implicit $exec
143 %77:vreg_64 = COPY %10.sub0_sub1
144 %78:vreg_64 = FLAT_LOAD_DWORDX2 %77, 0, 0, implicit $exec, implicit $flat_scr
145 %79:vreg_64 = COPY %10.sub2_sub3
146 %80:vreg_64 = FLAT_LOAD_DWORDX2 %79, 0, 0, implicit $exec, implicit $flat_scr
147 %81:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %29, implicit $exec
148 $vcc_lo = S_AND_B32 $exec_lo, %81, implicit-def dead $scc
149 %82:sreg_64 = COPY %12.sub0_sub1
150 S_CBRANCH_VCCNZ %bb.10, implicit killed $vcc
154 %82:sreg_64 = S_MOV_B64 0
158 %83:sreg_32 = S_XOR_B32 %68, -1, implicit-def dead $scc
159 %84:sreg_32 = S_AND_B32 $exec_lo, %58, implicit-def $scc
160 %59:sreg_32 = S_OR_B32 %84, %59, implicit-def $scc
161 %4:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
162 %85:sreg_32 = S_ANDN2_B32 %7, $exec_lo, implicit-def dead $scc
163 %86:sreg_32 = S_AND_B32 %83, $exec_lo, implicit-def dead $scc
164 %7:sreg_32 = S_OR_B32 %85, %86, implicit-def dead $scc
165 $exec_lo = S_ANDN2_B32_term $exec_lo, %59, implicit-def $scc
166 S_CBRANCH_EXECNZ %bb.3, implicit $exec
170 %87:sreg_64_xexec = S_LOAD_DWORDX2_IMM %26, 16, 0
171 undef %88.sub1:sreg_64 = S_AND_B32 %87.sub1, 2147483647, implicit-def dead $scc
172 %89:vgpr_32 = nofpexcept V_FREXP_EXP_I32_F64_e64 2, %87, 0, 0, implicit $mode, implicit $exec
173 %90:vreg_64 = V_CVT_F64_I32_e32 %89, implicit $mode, implicit $exec
174 %91:vreg_64 = nofpexcept V_FMA_F64_e64 0, 0, 0, %30, 0, %87, 0, 0, implicit $mode, implicit $exec
175 %0:sreg_32 = nofpexcept V_CMP_LT_F64_e64 0, %27, 0, %91, 0, implicit $mode, implicit $exec
176 %31.sub0:sreg_64 = COPY %27.sub0
177 %1:sreg_32 = nofpexcept V_CMP_GT_F64_e64 0, %31, 0, %90, 0, implicit $mode, implicit $exec
178 S_CBRANCH_SCC0 %bb.12, implicit undef $scc
181 %92:sreg_32_xm0_xexec = S_OR_B32 %1, %0, implicit-def dead $scc
182 undef %93.sub1:vreg_64 = V_CNDMASK_B32_e64 0, %21.sub3, 0, 0, %92, implicit $exec
183 %93.sub0:vreg_64 = V_CNDMASK_B32_e64 0, %21.sub2, 0, 0, %92, implicit $exec
187 %93:vreg_64 = V_MOV_B64_PSEUDO 0, implicit $exec
190 %88.sub0:sreg_64 = COPY %87.sub0
191 %94:vgpr_32 = COPY %16.sub0
192 %95:vgpr_32 = V_CNDMASK_B32_e64 0, %82.sub0, 0, %94, %2, implicit $exec
193 %96:vgpr_32 = COPY %16.sub1
194 %97:vgpr_32 = V_CNDMASK_B32_e64 0, %82.sub1, 0, %96, %2, implicit $exec
195 %98:vgpr_32 = V_CNDMASK_B32_e64 0, %97, 0, 2146959360, %18, implicit $exec
196 dead %99:sreg_32 = S_AND_B32 %32, $exec_lo, implicit-def $scc
197 %100:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed $scc
198 undef %101.sub0:vreg_64 = V_CNDMASK_B32_e64 0, %95, 0, 0, %100, implicit $exec
199 %101.sub1:vreg_64 = V_CNDMASK_B32_e64 0, %98, 0, 0, %19, implicit $exec
200 %64:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %64, 0, %101, 0, 0, implicit $mode, implicit $exec
201 %63:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %63, 0, %21.sub0_sub1, 0, 0, implicit $mode, implicit $exec
202 %62:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %62, 0, %12.sub2_sub3, 0, 0, implicit $mode, implicit $exec
203 %33.sub0:sreg_64 = COPY %27.sub0
204 %102:sreg_32_xm0_xexec = nofpexcept V_CMP_EQ_F64_e64 0, %33, 0, %88, 0, implicit $mode, implicit $exec
205 %103:sreg_32 = nofpexcept V_CMP_EQ_F64_e64 0, 0, 0, %87, 0, implicit $mode, implicit $exec
206 %104:sreg_32 = S_XOR_B32 %15, %103, implicit-def dead $scc
207 dead %105:sreg_32 = S_AND_B32 %104, $exec_lo, implicit-def $scc
208 %106:sgpr_32 = S_CSELECT_B32 0, 2146435072, implicit killed $scc
209 %107:vgpr_32 = V_CNDMASK_B32_e64 0, %93.sub1, 0, %106, %102, implicit $exec
210 undef %108.sub1:vreg_64 = V_CNDMASK_B32_e64 0, %107, 0, 0, %23, implicit $exec
211 %109:sreg_32_xm0_xexec = S_OR_B32 %23, %102, implicit-def dead $scc
212 %108.sub0:vreg_64 = V_CNDMASK_B32_e64 0, %93.sub0, 0, 0, %109, implicit $exec
213 %61:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %61, 0, %108, 0, 0, implicit $mode, implicit $exec
214 %110:vreg_64 = nofpexcept V_FMA_F64_e64 0, %78, 0, %35, 0, %34, 0, 0, implicit $mode, implicit $exec
215 %111:vreg_64 = nofpexcept V_FMA_F64_e64 0, %110, 0, 0, 0, %36, 0, 0, implicit $mode, implicit $exec
216 %112:vreg_64 = nofpexcept V_FMA_F64_e64 0, %111, 0, 0, 0, %37, 0, 0, implicit $mode, implicit $exec
217 %113:vreg_64 = nofpexcept V_FMA_F64_e64 0, %112, 0, 0, 0, %38, 0, 0, implicit $mode, implicit $exec
218 %114:vreg_64 = nofpexcept V_FMA_F64_e64 0, %113, 0, 0, 0, %39, 0, 0, implicit $mode, implicit $exec
219 %115:vreg_64 = nofpexcept V_FMA_F64_e64 0, %114, 0, 0, 0, %40, 0, 0, implicit $mode, implicit $exec
220 %116:vreg_64 = nofpexcept V_FMA_F64_e64 0, %115, 0, 0, 0, %41, 0, 0, implicit $mode, implicit $exec
221 %117:vreg_64 = nofpexcept V_FMA_F64_e64 0, %116, 0, 0, 0, %42, 0, 0, implicit $mode, implicit $exec
222 %118:vreg_64 = nofpexcept V_ADD_F64_e64 0, %117, 0, %43, 0, 0, implicit $mode, implicit $exec
223 %44.sub0:sreg_64 = COPY %43.sub0
224 %119:vreg_64 = nofpexcept V_ADD_F64_e64 0, %118, 0, %44, 0, 0, implicit $mode, implicit $exec
225 %120:vreg_64 = nofpexcept V_ADD_F64_e64 0, %24, 0, %119, 0, 0, implicit $mode, implicit $exec
226 %121:vreg_64 = nofpexcept V_MUL_F64_e64 0, %9, 0, %120, 0, 0, implicit $mode, implicit $exec
227 %122:vreg_64 = nofpexcept V_MUL_F64_e64 0, %121, 0, %45, 0, 0, implicit $mode, implicit $exec
228 %46.sub0:sreg_64 = COPY %30.sub0
229 %123:vreg_64 = nofpexcept V_FMA_F64_e64 0, %122, 0, %46, 0, %20, 0, 0, implicit $mode, implicit $exec
230 %124:vreg_64 = nofpexcept V_FMA_F64_e64 0, %123, 0, %48, 0, %47, 0, 0, implicit $mode, implicit $exec
231 %125:vreg_64 = nofpexcept V_FMA_F64_e64 0, %124, 0, 0, 0, %49, 0, 0, implicit $mode, implicit $exec
232 %126:vreg_64 = nofpexcept V_FMA_F64_e64 0, %125, 0, 0, 0, %50, 0, 0, implicit $mode, implicit $exec
233 %127:vreg_64 = nofpexcept V_FMA_F64_e64 0, %126, 0, 0, 0, %51, 0, 0, implicit $mode, implicit $exec
234 %128:vreg_64 = nofpexcept V_FMA_F64_e64 0, %127, 0, 0, 0, %52, 0, 0, implicit $mode, implicit $exec
235 %129:vreg_64 = nofpexcept V_FMA_F64_e64 0, %128, 0, 0, 0, %53, 0, 0, implicit $mode, implicit $exec
236 %130:vreg_64 = nofpexcept V_FMA_F64_e64 0, %129, 0, 0, 0, %54, 0, 0, implicit $mode, implicit $exec
237 %131:vreg_64 = nofpexcept V_FMA_F64_e64 0, %130, 0, 0, 0, %55, 0, 0, implicit $mode, implicit $exec
238 %132:vreg_64 = nofpexcept V_FMA_F64_e64 0, %131, 0, 0, 0, %56, 0, 0, implicit $mode, implicit $exec
239 %60:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %60, 0, %132, 0, 0, implicit $mode, implicit $exec
240 %133:vreg_64 = nofpexcept V_FMA_F64_e64 0, %80, 0, 0, 0, %36, 0, 0, implicit $mode, implicit $exec
241 %134:vreg_64 = nofpexcept V_FMA_F64_e64 0, %133, 0, 0, 0, %37, 0, 0, implicit $mode, implicit $exec
242 %135:vreg_64 = nofpexcept V_FMA_F64_e64 0, %134, 0, 0, 0, %38, 0, 0, implicit $mode, implicit $exec
243 %136:vreg_64 = nofpexcept V_FMA_F64_e64 0, %135, 0, 0, 0, %39, 0, 0, implicit $mode, implicit $exec
244 %137:vreg_64 = nofpexcept V_FMA_F64_e64 0, %136, 0, 0, 0, %40, 0, 0, implicit $mode, implicit $exec
245 %138:vreg_64 = nofpexcept V_FMA_F64_e64 0, %137, 0, 0, 0, %41, 0, 0, implicit $mode, implicit $exec
246 %139:vreg_64 = nofpexcept V_FMA_F64_e64 0, %138, 0, 0, 0, %42, 0, 0, implicit $mode, implicit $exec
247 %140:vreg_64 = nofpexcept V_MUL_F64_e64 0, %139, 0, %45, 0, 0, implicit $mode, implicit $exec
248 %57.sub0:sreg_64 = COPY %48.sub0
249 %141:vreg_64 = nofpexcept V_FMA_F64_e64 0, %140, 0, %57, 0, %47, 0, 0, implicit $mode, implicit $exec
250 %142:vreg_64 = nofpexcept V_FMA_F64_e64 0, %141, 0, 0, 0, %49, 0, 0, implicit $mode, implicit $exec
251 %143:vreg_64 = nofpexcept V_FMA_F64_e64 0, %142, 0, 0, 0, %50, 0, 0, implicit $mode, implicit $exec
252 %144:vreg_64 = nofpexcept V_FMA_F64_e64 0, %143, 0, 0, 0, %51, 0, 0, implicit $mode, implicit $exec
253 %145:vreg_64 = nofpexcept V_FMA_F64_e64 0, %144, 0, 0, 0, %52, 0, 0, implicit $mode, implicit $exec
254 %146:vreg_64 = nofpexcept V_FMA_F64_e64 0, %145, 0, 0, 0, %53, 0, 0, implicit $mode, implicit $exec
255 %147:vreg_64 = nofpexcept V_FMA_F64_e64 0, %146, 0, 0, 0, %54, 0, 0, implicit $mode, implicit $exec
256 %148:vreg_64 = nofpexcept V_FMA_F64_e64 0, %147, 0, 0, 0, %55, 0, 0, implicit $mode, implicit $exec
257 %149:vreg_64 = nofpexcept V_FMA_F64_e64 0, %148, 0, 0, 0, %56, 0, 0, implicit $mode, implicit $exec
258 %28:vreg_64 = contract nofpexcept V_ADD_F64_e64 0, %28, 0, %149, 0, 0, implicit $mode, implicit $exec
259 %58:sreg_32 = V_CMP_LE_U32_e64 %8.sub0, %4, implicit $exec
260 %68:sreg_32 = S_MOV_B32 0
264 S_CBRANCH_SCC1 %bb.17, implicit undef $scc
268 %150:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %74, implicit $exec
269 $vcc_lo = S_AND_B32 $exec_lo, %150, implicit-def dead $scc
270 S_CBRANCH_VCCNZ %bb.17, implicit killed $vcc
274 %151:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %75, implicit $exec
275 $vcc_lo = S_AND_B32 $exec_lo, %151, implicit-def dead $scc
276 S_CBRANCH_VCCNZ %bb.16, implicit killed $vcc
280 %152:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %76, implicit $exec
281 $vcc_lo = S_AND_B32 $exec_lo, %152, implicit-def dead $scc
282 S_CBRANCH_VCCNZ %bb.14, implicit killed $vcc
286 $exec_lo = S_OR_B32 $exec_lo, %65, implicit-def $scc
290 $exec_lo = S_OR_B32 $exec_lo, %59, implicit-def $scc