1# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass si-load-store-opt -o - %s | FileCheck -check-prefix=GFX9 %s
2
3# GFX9-LABEL: name: image_load_merged_v1v3
4# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
5# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
6# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
7
8name: image_load_merged_v1v3
9body:             |
10  bb.0.entry:
11    %0:sgpr_64 = COPY $sgpr0_sgpr1
12    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
13    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
14    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
15    %4:vgpr_32 = COPY %2.sub3
16    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
17    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
18    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
19...
20---
21# GFX9-LABEL: name: image_load_merged_v1v3_reversed
22# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
23# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub3
24# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub0_sub1_sub2
25
26name: image_load_merged_v1v3_reversed
27body:             |
28  bb.0.entry:
29    %0:sgpr_64 = COPY $sgpr0_sgpr1
30    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
31    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
32    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
33    %4:vgpr_32 = COPY %2.sub3
34    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
35    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
36    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
37...
38---
39
40# GFX9-LABEL: name: image_load_merged_v2v2
41# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, addrspace 4)
42# GFX9: %{{[0-9]+}}:vreg_64 = COPY %8.sub0_sub1
43# GFX9: %{{[0-9]+}}:vreg_64 = COPY killed %8.sub2_sub3
44
45name: image_load_merged_v2v2
46body:             |
47  bb.0.entry:
48    %0:sgpr_64 = COPY $sgpr0_sgpr1
49    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
50    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
51    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
52    %4:vgpr_32 = COPY %2.sub3
53    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
54    %6:vreg_64 = IMAGE_LOAD_V2_V4 %5:vreg_128, %3:sgpr_256, 3, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
55    %7:vreg_64 = IMAGE_LOAD_V2_V4 %5:vreg_128, %3:sgpr_256, 12, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
56...
57---
58
59# GFX9-LABEL: name: image_load_merged_v2v2_reversed
60# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, addrspace 4)
61# GFX9: %{{[0-9]+}}:vreg_64 = COPY %8.sub2_sub3
62# GFX9: %{{[0-9]+}}:vreg_64 = COPY killed %8.sub0_sub1
63
64name: image_load_merged_v2v2_reversed
65body:             |
66  bb.0.entry:
67    %0:sgpr_64 = COPY $sgpr0_sgpr1
68    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
69    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
70    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
71    %4:vgpr_32 = COPY %2.sub3
72    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
73    %6:vreg_64 = IMAGE_LOAD_V2_V4 %5:vreg_128, %3:sgpr_256, 12, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
74    %7:vreg_64 = IMAGE_LOAD_V2_V4 %5:vreg_128, %3:sgpr_256, 3, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
75...
76---
77
78# GFX9-LABEL: name: image_load_merged_v3v1
79# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, addrspace 4)
80# GFX9: %{{[0-9]+}}:vreg_96 = COPY %8.sub0_sub1_sub2
81# GFX9: %{{[0-9]+}}:vgpr_32 = COPY killed %8.sub3
82
83name: image_load_merged_v3v1
84body:             |
85  bb.0.entry:
86    %0:sgpr_64 = COPY $sgpr0_sgpr1
87    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
88    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
89    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
90    %4:vgpr_32 = COPY %2.sub3
91    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
92    %6:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
93    %7:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
94...
95---
96
97# GFX9-LABEL: name: image_load_merged_v3v1_reversed
98# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, addrspace 4)
99# GFX9: %{{[0-9]+}}:vreg_96 = COPY %8.sub1_sub2_sub3
100# GFX9: %{{[0-9]+}}:vgpr_32 = COPY killed %8.sub0
101
102name: image_load_merged_v3v1_reversed
103body:             |
104  bb.0.entry:
105    %0:sgpr_64 = COPY $sgpr0_sgpr1
106    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
107    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
108    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
109    %4:vgpr_32 = COPY %2.sub3
110    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
111    %6:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
112    %7:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
113...
114---
115
116# GFX9-LABEL: name: image_load_divided_merged
117# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
118
119name: image_load_divided_merged
120body:             |
121  bb.0.entry:
122    %0:sgpr_64 = COPY $sgpr0_sgpr1
123    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
124    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
125    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
126    %4:vgpr_32 = COPY %2.sub3
127    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
128    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
129    %7:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
130    %8:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
131    %9:vreg_96 = IMAGE_LOAD_V3_V4 %7:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
132    %10:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
133    %11:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
134...
135---
136
137# GFX9-LABEL: name: image_load_divided_not_merged
138# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
139# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
140
141name: image_load_divided_not_merged
142body:             |
143  bb.0.entry:
144    %0:sgpr_64 = COPY $sgpr0_sgpr1
145    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
146    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
147    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
148    %4:vreg_128 = COPY %2
149    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
150    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
151    IMAGE_STORE_V4_V4 %4:vreg_128, %5:vreg_128, %3:sgpr_256, 15, -1, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (store 16)
152    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
153...
154---
155
156# GFX9-LABEL: name: image_load_dmask_overlapped_not_merged
157# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 4, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
158# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
159
160name: image_load_dmask_overlapped_not_merged
161body:             |
162  bb.0.entry:
163    %0:sgpr_64 = COPY $sgpr0_sgpr1
164    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
165    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
166    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
167    %4:vgpr_32 = COPY %2.sub3
168    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
169    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 4, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
170    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
171...
172---
173
174# GFX9-LABEL: name: image_load_dmask_not_disjoint_not_merged
175# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 4, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
176# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 11, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
177
178name: image_load_dmask_not_disjoint_not_merged
179body:             |
180  bb.0.entry:
181    %0:sgpr_64 = COPY $sgpr0_sgpr1
182    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
183    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
184    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
185    %4:vgpr_32 = COPY %2.sub3
186    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
187    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5:vreg_128, %3:sgpr_256, 4, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
188    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5:vreg_128, %3:sgpr_256, 11, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
189...
190---
191
192# GFX9-LABEL: name: image_load_not_merged_0
193# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
194# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %6, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
195
196name: image_load_not_merged_0
197body:             |
198  bb.0.entry:
199    %0:sgpr_64 = COPY $sgpr0_sgpr1
200    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
201    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
202    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
203    %4:vgpr_32 = COPY %2.sub3
204    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
205    %6:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 1, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
206    %7:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
207    %8:vreg_96 = IMAGE_LOAD_V3_V4 %6, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
208...
209---
210
211# GFX9-LABEL: name: image_load_not_merged_1
212# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %6, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
213# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %6, %4, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
214
215name: image_load_not_merged_1
216body:             |
217  bb.0.entry:
218    %0:sgpr_64 = COPY $sgpr0_sgpr1
219    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
220    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
221    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
222    %4:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
223    %5:vgpr_32 = COPY %2.sub3
224    %6:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
225    %7:vgpr_32 = IMAGE_LOAD_V1_V4 %6, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
226    %8:vreg_96 = IMAGE_LOAD_V3_V4 %6, %4, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
227...
228---
229
230# GFX9-LABEL: name: image_load_not_merged_10
231# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
232# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
233
234name: image_load_not_merged_10
235body:             |
236  bb.0.entry:
237    %0:sgpr_64 = COPY $sgpr0_sgpr1
238    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
239    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
240    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
241    %4:vgpr_32 = COPY %2.sub3
242    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
243    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
244    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
245...
246---
247
248# GFX9-LABEL: name: image_load_not_merged_3
249# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
250# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 1, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
251
252name: image_load_not_merged_3
253body:             |
254  bb.0.entry:
255    %0:sgpr_64 = COPY $sgpr0_sgpr1
256    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
257    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
258    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
259    %4:vgpr_32 = COPY %2.sub3
260    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
261    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
262    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 1, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
263...
264---
265
266# GFX9-LABEL: name: image_load_not_merged_4
267# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
268# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 1, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
269
270name: image_load_not_merged_4
271body:             |
272  bb.0.entry:
273    %0:sgpr_64 = COPY $sgpr0_sgpr1
274    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
275    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
276    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
277    %4:vgpr_32 = COPY %2.sub3
278    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
279    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
280    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 1, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
281...
282---
283
284# GFX9-LABEL: name: image_load_not_merged_5
285# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
286# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 1, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
287
288name: image_load_not_merged_5
289body:             |
290  bb.0.entry:
291    %0:sgpr_64 = COPY $sgpr0_sgpr1
292    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
293    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
294    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
295    %4:vgpr_32 = COPY %2.sub3
296    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
297    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
298    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 1, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
299...
300---
301
302# GFX9-LABEL: name: image_load_not_merged_6
303# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
304# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 1, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
305
306name: image_load_not_merged_6
307body:             |
308  bb.0.entry:
309    %0:sgpr_64 = COPY $sgpr0_sgpr1
310    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
311    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
312    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
313    %4:vgpr_32 = COPY %2.sub3
314    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
315    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
316    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 1, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
317...
318---
319
320# GFX9-LABEL: name: image_load_not_merged_7
321# GFX9: %{{[0-9]+}}:vreg_64 = IMAGE_LOAD_V2_V4 %5, %3, 8, 0, 0, 0, 0, 1, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
322# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
323
324name: image_load_not_merged_7
325body:             |
326  bb.0.entry:
327    %0:sgpr_64 = COPY $sgpr0_sgpr1
328    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
329    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
330    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
331    %4:vgpr_32 = COPY %2.sub3
332    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
333    %6:vreg_64 = IMAGE_LOAD_V2_V4 %5, %3, 8, 0, 0, 0, 0, 1, 0, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
334    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
335...
336---
337
338# GFX9-LABEL: name: image_load_not_merged_8
339# GFX9: %{{[0-9]+}}:vreg_64 = IMAGE_LOAD_V2_V4 %5, %3, 8, 0, 0, 0, 0, 0, 1, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
340# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
341
342name: image_load_not_merged_8
343body:             |
344  bb.0.entry:
345    %0:sgpr_64 = COPY $sgpr0_sgpr1
346    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
347    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
348    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
349    %4:vgpr_32 = COPY %2.sub3
350    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
351    %6:vreg_64 = IMAGE_LOAD_V2_V4 %5, %3, 8, 0, 0, 0, 0, 0, 1, -1, 0, implicit $exec :: (dereferenceable load 8, align 16, addrspace 4)
352    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
353...
354---
355
356# GFX9-LABEL: name: image_load_not_merged_9
357# GFX9: %{{[0-9]+}}:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
358# GFX9: %{{[0-9]+}}:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
359
360name: image_load_not_merged_9
361body:             |
362  bb.0.entry:
363    %0:sgpr_64 = COPY $sgpr0_sgpr1
364    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
365    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
366    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
367    %4:vgpr_32 = COPY %2.sub3
368    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
369    %6:vgpr_32 = IMAGE_LOAD_V1_V4 %5, %3, 8, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
370    %7:vreg_96 = IMAGE_LOAD_V3_V4 %5, %3, 7, 0, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
371...
372---
373
374# GFX9-LABEL: name: image_load_mip_merged_v1v3
375# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_MIP_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
376# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
377# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
378
379name: image_load_mip_merged_v1v3
380body:             |
381  bb.0.entry:
382    %0:sgpr_64 = COPY $sgpr0_sgpr1
383    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
384    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
385    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
386    %4:vgpr_32 = COPY %2.sub3
387    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
388    %6:vgpr_32 = IMAGE_LOAD_MIP_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 4, addrspace 4)
389    %7:vreg_96 = IMAGE_LOAD_MIP_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, 0, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
390...
391---
392
393
394
395# GFX9-LABEL: name: image_load_mip_pck_merged_v1v3
396# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_MIP_PCK_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
397# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
398# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
399
400name: image_load_mip_pck_merged_v1v3
401body:             |
402  bb.0.entry:
403    %0:sgpr_64 = COPY $sgpr0_sgpr1
404    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
405    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
406    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
407    %4:vgpr_32 = COPY %2.sub3
408    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
409    %6:vgpr_32 = IMAGE_LOAD_MIP_PCK_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 4, addrspace 4)
410    %7:vreg_96 = IMAGE_LOAD_MIP_PCK_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
411...
412---
413
414
415
416# GFX9-LABEL: name: image_load_mip_pck_sgn_merged_v1v3
417# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_MIP_PCK_SGN_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
418# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
419# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
420
421name: image_load_mip_pck_sgn_merged_v1v3
422body:             |
423  bb.0.entry:
424    %0:sgpr_64 = COPY $sgpr0_sgpr1
425    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
426    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
427    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
428    %4:vgpr_32 = COPY %2.sub3
429    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
430    %6:vgpr_32 = IMAGE_LOAD_MIP_PCK_SGN_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 4, addrspace 4)
431    %7:vreg_96 = IMAGE_LOAD_MIP_PCK_SGN_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
432...
433---
434
435# GFX9-LABEL: name: image_load_pck_merged_v1v3
436# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_PCK_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
437# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
438# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
439
440name: image_load_pck_merged_v1v3
441body:             |
442  bb.0.entry:
443    %0:sgpr_64 = COPY $sgpr0_sgpr1
444    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
445    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
446    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
447    %4:vgpr_32 = COPY %2.sub3
448    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
449    %6:vgpr_32 = IMAGE_LOAD_PCK_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 4, addrspace 4)
450    %7:vreg_96 = IMAGE_LOAD_PCK_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
451...
452---
453
454# GFX9-LABEL: name: image_load_pck_sgn_merged_v1v3
455# GFX9: %{{[0-9]+}}:vreg_128 = IMAGE_LOAD_PCK_SGN_V4_V4 %5, %3, 15, 0, 0, 0, 0, 0, 0, -1, implicit $exec, implicit $exec :: (dereferenceable load 16, align 4, addrspace 4)
456# GFX9: %{{[0-9]+}}:vgpr_32 = COPY %8.sub0
457# GFX9: %{{[0-9]+}}:vreg_96 = COPY killed %8.sub1_sub2_sub3
458
459name: image_load_pck_sgn_merged_v1v3
460body:             |
461  bb.0.entry:
462    %0:sgpr_64 = COPY $sgpr0_sgpr1
463    %1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 36, 0, 0
464    %2:sgpr_128 = COPY $sgpr96_sgpr97_sgpr98_sgpr99
465    %3:sgpr_256 = S_LOAD_DWORDX8_IMM %1, 208, 0, 0
466    %4:vgpr_32 = COPY %2.sub3
467    %5:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %2:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable invariant load 16)
468    %6:vgpr_32 = IMAGE_LOAD_PCK_SGN_V1_V4 %5:vreg_128, %3:sgpr_256, 1, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 4, addrspace 4)
469    %7:vreg_96 = IMAGE_LOAD_PCK_SGN_V3_V4 %5:vreg_128, %3:sgpr_256, 14, 0, 0, 0, 0, 0, 0, -1, implicit $exec :: (dereferenceable load 12, align 16, addrspace 4)
470...
471---
472