1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck --check-prefix=GFX90A %s
4 # Should fold only the aligned agpr copies with their uses.
8 tracksRegLiveness: true
12 ; GFX90A-LABEL: name: aligned_agpr_64
13 ; GFX90A: liveins: $vgpr0_vgpr1
15 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
16 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_64_align2 = IMPLICIT_DEF
17 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]], 0, 0, implicit $exec
18 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
19 %1:areg_64_align2 = IMPLICIT_DEF
20 %2:areg_64_align2 = COPY killed %1
21 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
25 name: unaligned_agpr_64
26 tracksRegLiveness: true
30 ; GFX90A-LABEL: name: unaligned_agpr_64
31 ; GFX90A: liveins: $vgpr0_vgpr1
33 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
34 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_64 = IMPLICIT_DEF
35 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_64_align2 = COPY killed [[DEF]]
36 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
37 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
38 %1:areg_64 = IMPLICIT_DEF
39 %2:areg_64_align2 = COPY killed %1
40 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
44 name: aligned_agpr_96_sub0_subg1
45 tracksRegLiveness: true
49 ; GFX90A-LABEL: name: aligned_agpr_96_sub0_subg1
50 ; GFX90A: liveins: $vgpr0_vgpr1
52 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
53 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_96_align2 = IMPLICIT_DEF
54 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
55 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
56 %1:areg_96_align2 = IMPLICIT_DEF
57 %2:areg_64_align2 = COPY killed %1.sub0_sub1:areg_96_align2
58 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
62 name: unaligned_agpr_96_sub1_sub2
63 tracksRegLiveness: true
67 ; GFX90A-LABEL: name: unaligned_agpr_96_sub1_sub2
68 ; GFX90A: liveins: $vgpr0_vgpr1
70 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
71 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_96_align2 = IMPLICIT_DEF
72 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_64_align2 = COPY killed [[DEF]].sub1_sub2
73 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
74 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
75 %1:areg_96_align2 = IMPLICIT_DEF
76 %2:areg_64_align2 = COPY killed %1.sub1_sub2:areg_96_align2
77 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
82 tracksRegLiveness: true
86 ; GFX90A-LABEL: name: aligned_agpr_96
87 ; GFX90A: liveins: $vgpr0_vgpr1
89 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
90 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_96_align2 = IMPLICIT_DEF
91 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]], 0, 0, implicit $exec
92 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
93 %1:areg_96_align2 = IMPLICIT_DEF
94 %2:areg_96_align2 = COPY killed %1
95 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
99 name: unaligned_agpr_96
100 tracksRegLiveness: true
103 liveins: $vgpr0_vgpr1
104 ; GFX90A-LABEL: name: unaligned_agpr_96
105 ; GFX90A: liveins: $vgpr0_vgpr1
106 ; GFX90A-NEXT: {{ $}}
107 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
108 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_96 = IMPLICIT_DEF
109 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_96_align2 = COPY killed [[DEF]]
110 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[COPY1]], 0, 0, implicit $exec
111 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
112 %1:areg_96 = IMPLICIT_DEF
113 %2:areg_96_align2 = COPY killed %1
114 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
118 name: aligned_agpr_128_sub0_sub1
119 tracksRegLiveness: true
122 liveins: $vgpr0_vgpr1
123 ; GFX90A-LABEL: name: aligned_agpr_128_sub0_sub1
124 ; GFX90A: liveins: $vgpr0_vgpr1
125 ; GFX90A-NEXT: {{ $}}
126 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
127 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
128 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
129 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
130 %1:areg_128_align2 = IMPLICIT_DEF
131 %2:areg_64_align2 = COPY killed %1.sub0_sub1:areg_128_align2
132 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
136 name: aligned_agpr_128_sub2_sub3
137 tracksRegLiveness: true
140 liveins: $vgpr0_vgpr1
141 ; GFX90A-LABEL: name: aligned_agpr_128_sub2_sub3
142 ; GFX90A: liveins: $vgpr0_vgpr1
143 ; GFX90A-NEXT: {{ $}}
144 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
145 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
146 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub2_sub3, 0, 0, implicit $exec
147 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
148 %1:areg_128_align2 = IMPLICIT_DEF
149 %2:areg_64_align2 = COPY killed %1.sub2_sub3:areg_128_align2
150 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
154 name: unaligned_agpr_128_sub1_sub2
155 tracksRegLiveness: true
158 liveins: $vgpr0_vgpr1
159 ; GFX90A-LABEL: name: unaligned_agpr_128_sub1_sub2
160 ; GFX90A: liveins: $vgpr0_vgpr1
161 ; GFX90A-NEXT: {{ $}}
162 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
163 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
164 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_64_align2 = COPY killed [[DEF]].sub1_sub2
165 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
166 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
167 %1:areg_128_align2 = IMPLICIT_DEF
168 %2:areg_64_align2 = COPY killed %1.sub1_sub2:areg_128_align2
169 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
173 name: aligned_agpr_128_sub0_sub1_sub2
174 tracksRegLiveness: true
177 liveins: $vgpr0_vgpr1
178 ; GFX90A-LABEL: name: aligned_agpr_128_sub0_sub1_sub2
179 ; GFX90A: liveins: $vgpr0_vgpr1
180 ; GFX90A-NEXT: {{ $}}
181 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
182 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
183 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]].sub0_sub1_sub2, 0, 0, implicit $exec
184 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
185 %1:areg_128_align2 = IMPLICIT_DEF
186 %2:areg_96_align2 = COPY killed %1.sub0_sub1_sub2:areg_128_align2
187 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
191 name: unaligned_agpr_128_sub1_sub2_sub3
192 tracksRegLiveness: true
195 liveins: $vgpr0_vgpr1
196 ; GFX90A-LABEL: name: unaligned_agpr_128_sub1_sub2_sub3
197 ; GFX90A: liveins: $vgpr0_vgpr1
198 ; GFX90A-NEXT: {{ $}}
199 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
200 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
201 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_96_align2 = COPY killed [[DEF]].sub1_sub2_sub3
202 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[COPY1]], 0, 0, implicit $exec
203 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
204 %1:areg_128_align2 = IMPLICIT_DEF
205 %2:areg_96_align2 = COPY killed %1.sub1_sub2_sub3:areg_128_align2
206 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
210 name: aligned_agpr_128
211 tracksRegLiveness: true
214 liveins: $vgpr0_vgpr1
215 ; GFX90A-LABEL: name: aligned_agpr_128
216 ; GFX90A: liveins: $vgpr0_vgpr1
217 ; GFX90A-NEXT: {{ $}}
218 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
219 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128_align2 = IMPLICIT_DEF
220 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[DEF]], 0, 0, implicit $exec
221 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
222 %1:areg_128_align2 = IMPLICIT_DEF
223 %2:areg_128_align2 = COPY killed %1
224 GLOBAL_STORE_DWORDX4 %0, %2, 0, 0, implicit $exec
228 name: unaligned_agpr_128
229 tracksRegLiveness: true
232 liveins: $vgpr0_vgpr1
233 ; GFX90A-LABEL: name: unaligned_agpr_128
234 ; GFX90A: liveins: $vgpr0_vgpr1
235 ; GFX90A-NEXT: {{ $}}
236 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
237 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:areg_128 = IMPLICIT_DEF
238 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:areg_128_align2 = COPY killed [[DEF]]
239 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[COPY1]], 0, 0, implicit $exec
240 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
241 %1:areg_128 = IMPLICIT_DEF
242 %2:areg_128_align2 = COPY killed %1
243 GLOBAL_STORE_DWORDX4 %0, %2, 0, 0, implicit $exec