1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-NOHSA -check-prefix=FUNC %s
2; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-HSA -check-prefix=FUNC %s
3; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-NOHSA -check-prefix=FUNC %s
4; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
5
6
7; FUNC-LABEL: {{^}}constant_load_i8:
8; GCN-NOHSA: buffer_load_ubyte v{{[0-9]+}}
9; GCN-HSA: flat_load_ubyte
10
11; EG: VTX_READ_8 T{{[0-9]+}}.X, T{{[0-9]+}}.X, 0
12define void @constant_load_i8(i8 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
13entry:
14  %ld = load i8, i8 addrspace(2)* %in
15  store i8 %ld, i8 addrspace(1)* %out
16  ret void
17}
18
19; FUNC-LABEL: {{^}}constant_load_v2i8:
20; GCN-NOHSA: buffer_load_ushort v
21; GCN-HSA: flat_load_ushort v
22
23; EG: VTX_READ_16
24define void @constant_load_v2i8(<2 x i8> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
25entry:
26  %ld = load <2 x i8>, <2 x i8> addrspace(2)* %in
27  store <2 x i8> %ld, <2 x i8> addrspace(1)* %out
28  ret void
29}
30
31; FUNC-LABEL: {{^}}constant_load_v3i8:
32; GCN: s_load_dword s
33
34; EG-DAG: VTX_READ_32
35define void @constant_load_v3i8(<3 x i8> addrspace(1)* %out, <3 x i8> addrspace(2)* %in) #0 {
36entry:
37  %ld = load <3 x i8>, <3 x i8> addrspace(2)* %in
38  store <3 x i8> %ld, <3 x i8> addrspace(1)* %out
39  ret void
40}
41
42; FUNC-LABEL: {{^}}constant_load_v4i8:
43; GCN: s_load_dword s
44
45; EG: VTX_READ_32
46define void @constant_load_v4i8(<4 x i8> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
47entry:
48  %ld = load <4 x i8>, <4 x i8> addrspace(2)* %in
49  store <4 x i8> %ld, <4 x i8> addrspace(1)* %out
50  ret void
51}
52
53; FUNC-LABEL: {{^}}constant_load_v8i8:
54; GCN: s_load_dwordx2
55
56; EG: VTX_READ_64
57define void @constant_load_v8i8(<8 x i8> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
58entry:
59  %ld = load <8 x i8>, <8 x i8> addrspace(2)* %in
60  store <8 x i8> %ld, <8 x i8> addrspace(1)* %out
61  ret void
62}
63
64; FUNC-LABEL: {{^}}constant_load_v16i8:
65; GCN: s_load_dwordx4
66
67; EG: VTX_READ_128
68define void @constant_load_v16i8(<16 x i8> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
69entry:
70  %ld = load <16 x i8>, <16 x i8> addrspace(2)* %in
71  store <16 x i8> %ld, <16 x i8> addrspace(1)* %out
72  ret void
73}
74
75; FUNC-LABEL: {{^}}constant_zextload_i8_to_i32:
76; GCN-NOHSA: buffer_load_ubyte v{{[0-9]+}},
77; GCN-HSA: flat_load_ubyte
78
79; EG: VTX_READ_8 T{{[0-9]+\.X, T[0-9]+\.X}}
80define void @constant_zextload_i8_to_i32(i32 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
81  %a = load i8, i8 addrspace(2)* %in
82  %ext = zext i8 %a to i32
83  store i32 %ext, i32 addrspace(1)* %out
84  ret void
85}
86
87; FUNC-LABEL: {{^}}constant_sextload_i8_to_i32:
88; GCN-NOHSA: buffer_load_sbyte
89; GCN-HSA: flat_load_sbyte
90
91; EG: VTX_READ_8 [[DST:T[0-9]\.[XYZW]]], [[DST]]
92; EG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST]], 0.0, literal
93; EG: 8
94define void @constant_sextload_i8_to_i32(i32 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
95  %ld = load i8, i8 addrspace(2)* %in
96  %ext = sext i8 %ld to i32
97  store i32 %ext, i32 addrspace(1)* %out
98  ret void
99}
100
101; FUNC-LABEL: {{^}}constant_zextload_v1i8_to_v1i32:
102define void @constant_zextload_v1i8_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
103  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
104  %ext = zext <1 x i8> %load to <1 x i32>
105  store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
106  ret void
107}
108
109; FUNC-LABEL: {{^}}constant_sextload_v1i8_to_v1i32:
110define void @constant_sextload_v1i8_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
111  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
112  %ext = sext <1 x i8> %load to <1 x i32>
113  store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
114  ret void
115}
116
117; FUNC-LABEL: {{^}}constant_zextload_v2i8_to_v2i32:
118; GCN-NOHSA: buffer_load_ushort
119; GCN-HSA: flat_load_ushort
120; EG: VTX_READ_8
121; EG: VTX_READ_8
122define void @constant_zextload_v2i8_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
123  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
124  %ext = zext <2 x i8> %load to <2 x i32>
125  store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
126  ret void
127}
128
129; FUNC-LABEL: {{^}}constant_sextload_v2i8_to_v2i32:
130; GCN-NOHSA: buffer_load_ushort
131
132; GCN-HSA: flat_load_ushort
133
134; GCN: v_bfe_i32
135; GCN: v_bfe_i32
136
137; EG-DAG: VTX_READ_8 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
138; EG-DAG: VTX_READ_8 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
139; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
140; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
141; EG-DAG: 8
142; EG-DAG: 8
143define void @constant_sextload_v2i8_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
144  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
145  %ext = sext <2 x i8> %load to <2 x i32>
146  store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
147  ret void
148}
149
150; FUNC-LABEL: {{^}}constant_zextload_v3i8_to_v3i32:
151; GCN: s_load_dword s
152
153; GCN-DAG: s_bfe_u32
154; GCN-DAG: s_bfe_u32
155; GCN-DAG: s_and_b32
156define void @constant_zextload_v3i8_to_v3i32(<3 x i32> addrspace(1)* %out, <3 x i8> addrspace(2)* %in) #0 {
157entry:
158  %ld = load <3 x i8>, <3 x i8> addrspace(2)* %in
159  %ext = zext <3 x i8> %ld to <3 x i32>
160  store <3 x i32> %ext, <3 x i32> addrspace(1)* %out
161  ret void
162}
163
164; FUNC-LABEL: {{^}}constant_sextload_v3i8_to_v3i32:
165; GCN: s_load_dword s
166
167; GCN-DAG: s_bfe_i32
168; GCN-DAG: s_bfe_i32
169; GCN-DAG: s_bfe_i32
170define void @constant_sextload_v3i8_to_v3i32(<3 x i32> addrspace(1)* %out, <3 x i8> addrspace(2)* %in) #0 {
171entry:
172  %ld = load <3 x i8>, <3 x i8> addrspace(2)* %in
173  %ext = sext <3 x i8> %ld to <3 x i32>
174  store <3 x i32> %ext, <3 x i32> addrspace(1)* %out
175  ret void
176}
177
178; FUNC-LABEL: {{^}}constant_zextload_v4i8_to_v4i32:
179; GCN: s_load_dword s
180; GCN-DAG: s_and_b32
181; GCN-DAG: s_lshr_b32
182
183; EG: VTX_READ_8
184; EG: VTX_READ_8
185; EG: VTX_READ_8
186; EG: VTX_READ_8
187define void @constant_zextload_v4i8_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
188  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
189  %ext = zext <4 x i8> %load to <4 x i32>
190  store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
191  ret void
192}
193
194; FUNC-LABEL: {{^}}constant_sextload_v4i8_to_v4i32:
195; GCN: s_load_dword s
196; GCN-DAG: s_sext_i32_i8
197; GCN-DAG: s_ashr_i32
198
199; EG-DAG: VTX_READ_8 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
200; EG-DAG: VTX_READ_8 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
201; EG-DAG: VTX_READ_8 [[DST_Z:T[0-9]\.[XYZW]]], [[DST_Z]]
202; EG-DAG: VTX_READ_8 [[DST_W:T[0-9]\.[XYZW]]], [[DST_W]]
203; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
204; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
205; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Z]], 0.0, literal
206; EG-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_W]], 0.0, literal
207; EG-DAG: 8
208; EG-DAG: 8
209; EG-DAG: 8
210; EG-DAG: 8
211define void @constant_sextload_v4i8_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
212  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
213  %ext = sext <4 x i8> %load to <4 x i32>
214  store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
215  ret void
216}
217
218; FUNC-LABEL: {{^}}constant_zextload_v8i8_to_v8i32:
219; GCN: s_load_dwordx2
220; GCN-DAG: s_and_b32
221; GCN-DAG: s_lshr_b32
222define void @constant_zextload_v8i8_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
223  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
224  %ext = zext <8 x i8> %load to <8 x i32>
225  store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
226  ret void
227}
228
229; FUNC-LABEL: {{^}}constant_sextload_v8i8_to_v8i32:
230; GCN: s_load_dwordx2
231; GCN-DAG: s_ashr_i32
232; GCN-DAG: s_sext_i32_i8
233define void @constant_sextload_v8i8_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
234  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
235  %ext = sext <8 x i8> %load to <8 x i32>
236  store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
237  ret void
238}
239
240; FUNC-LABEL: {{^}}constant_zextload_v16i8_to_v16i32:
241define void @constant_zextload_v16i8_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
242  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
243  %ext = zext <16 x i8> %load to <16 x i32>
244  store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
245  ret void
246}
247
248; FUNC-LABEL: {{^}}constant_sextload_v16i8_to_v16i32:
249define void @constant_sextload_v16i8_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
250  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
251  %ext = sext <16 x i8> %load to <16 x i32>
252  store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
253  ret void
254}
255
256; FUNC-LABEL: {{^}}constant_zextload_v32i8_to_v32i32:
257define void @constant_zextload_v32i8_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
258  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
259  %ext = zext <32 x i8> %load to <32 x i32>
260  store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
261  ret void
262}
263
264; FUNC-LABEL: {{^}}constant_sextload_v32i8_to_v32i32:
265define void @constant_sextload_v32i8_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
266  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
267  %ext = sext <32 x i8> %load to <32 x i32>
268  store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
269  ret void
270}
271
272; FUNC-LABEL: {{^}}constant_zextload_v64i8_to_v64i32:
273define void @constant_zextload_v64i8_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
274  %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
275  %ext = zext <64 x i8> %load to <64 x i32>
276  store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
277  ret void
278}
279
280; FUNC-LABEL: {{^}}constant_sextload_v64i8_to_v64i32:
281define void @constant_sextload_v64i8_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
282  %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
283  %ext = sext <64 x i8> %load to <64 x i32>
284  store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
285  ret void
286}
287
288; FUNC-LABEL: {{^}}constant_zextload_i8_to_i64:
289; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0{{$}}
290
291; GCN-NOHSA-DAG: buffer_load_ubyte v[[LO:[0-9]+]],
292; GCN-NOHSA: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]]
293
294; GCN-HSA-DAG: flat_load_ubyte v[[LO:[0-9]+]],
295; GCN-HSA: flat_store_dwordx2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[LO]]:[[HI]]]
296define void @constant_zextload_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
297  %a = load i8, i8 addrspace(2)* %in
298  %ext = zext i8 %a to i64
299  store i64 %ext, i64 addrspace(1)* %out
300  ret void
301}
302
303; FUNC-LABEL: {{^}}constant_sextload_i8_to_i64:
304; GCN-NOHSA: buffer_load_sbyte v[[LO:[0-9]+]],
305; GCN-HSA: flat_load_sbyte v[[LO:[0-9]+]],
306; GCN: v_ashrrev_i32_e32 v[[HI:[0-9]+]], 31, v[[LO]]
307
308; GCN-NOHSA: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
309; GCN-HSA: flat_store_dwordx2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[LO]]:[[HI]]{{\]}}
310define void @constant_sextload_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
311  %a = load i8, i8 addrspace(2)* %in
312  %ext = sext i8 %a to i64
313  store i64 %ext, i64 addrspace(1)* %out
314  ret void
315}
316
317; FUNC-LABEL: {{^}}constant_zextload_v1i8_to_v1i64:
318define void @constant_zextload_v1i8_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
319  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
320  %ext = zext <1 x i8> %load to <1 x i64>
321  store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
322  ret void
323}
324
325; FUNC-LABEL: {{^}}constant_sextload_v1i8_to_v1i64:
326define void @constant_sextload_v1i8_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
327  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
328  %ext = sext <1 x i8> %load to <1 x i64>
329  store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
330  ret void
331}
332
333; FUNC-LABEL: {{^}}constant_zextload_v2i8_to_v2i64:
334define void @constant_zextload_v2i8_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
335  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
336  %ext = zext <2 x i8> %load to <2 x i64>
337  store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
338  ret void
339}
340
341; FUNC-LABEL: {{^}}constant_sextload_v2i8_to_v2i64:
342define void @constant_sextload_v2i8_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
343  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
344  %ext = sext <2 x i8> %load to <2 x i64>
345  store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
346  ret void
347}
348
349; FUNC-LABEL: {{^}}constant_zextload_v4i8_to_v4i64:
350define void @constant_zextload_v4i8_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
351  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
352  %ext = zext <4 x i8> %load to <4 x i64>
353  store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
354  ret void
355}
356
357; FUNC-LABEL: {{^}}constant_sextload_v4i8_to_v4i64:
358define void @constant_sextload_v4i8_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
359  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
360  %ext = sext <4 x i8> %load to <4 x i64>
361  store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
362  ret void
363}
364
365; FUNC-LABEL: {{^}}constant_zextload_v8i8_to_v8i64:
366define void @constant_zextload_v8i8_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
367  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
368  %ext = zext <8 x i8> %load to <8 x i64>
369  store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
370  ret void
371}
372
373; FUNC-LABEL: {{^}}constant_sextload_v8i8_to_v8i64:
374define void @constant_sextload_v8i8_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
375  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
376  %ext = sext <8 x i8> %load to <8 x i64>
377  store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
378  ret void
379}
380
381; FUNC-LABEL: {{^}}constant_zextload_v16i8_to_v16i64:
382define void @constant_zextload_v16i8_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
383  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
384  %ext = zext <16 x i8> %load to <16 x i64>
385  store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
386  ret void
387}
388
389; FUNC-LABEL: {{^}}constant_sextload_v16i8_to_v16i64:
390define void @constant_sextload_v16i8_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
391  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
392  %ext = sext <16 x i8> %load to <16 x i64>
393  store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
394  ret void
395}
396
397; FUNC-LABEL: {{^}}constant_zextload_v32i8_to_v32i64:
398define void @constant_zextload_v32i8_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
399  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
400  %ext = zext <32 x i8> %load to <32 x i64>
401  store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
402  ret void
403}
404
405; FUNC-LABEL: {{^}}constant_sextload_v32i8_to_v32i64:
406define void @constant_sextload_v32i8_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
407  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
408  %ext = sext <32 x i8> %load to <32 x i64>
409  store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
410  ret void
411}
412
413; XFUNC-LABEL: {{^}}constant_zextload_v64i8_to_v64i64:
414; define void @constant_zextload_v64i8_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
415;   %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
416;   %ext = zext <64 x i8> %load to <64 x i64>
417;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
418;   ret void
419; }
420
421; XFUNC-LABEL: {{^}}constant_sextload_v64i8_to_v64i64:
422; define void @constant_sextload_v64i8_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
423;   %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
424;   %ext = sext <64 x i8> %load to <64 x i64>
425;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
426;   ret void
427; }
428
429; FUNC-LABEL: {{^}}constant_zextload_i8_to_i16:
430; GCN-NOHSA: buffer_load_ubyte v[[VAL:[0-9]+]],
431; GCN-NOHSA: buffer_store_short v[[VAL]]
432
433; GCN-HSA: flat_load_ubyte v[[VAL:[0-9]+]],
434; GCN-HSA: flat_store_short v{{\[[0-9]+:[0-9]+\]}}, v[[VAL]]
435define void @constant_zextload_i8_to_i16(i16 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
436  %a = load i8, i8 addrspace(2)* %in
437  %ext = zext i8 %a to i16
438  store i16 %ext, i16 addrspace(1)* %out
439  ret void
440}
441
442; FUNC-LABEL: {{^}}constant_sextload_i8_to_i16:
443; GCN-NOHSA: buffer_load_sbyte v[[VAL:[0-9]+]],
444; GCN-HSA: flat_load_sbyte v[[VAL:[0-9]+]],
445
446; GCN-NOHSA: buffer_store_short v[[VAL]]
447; GCN-HSA: flat_store_short v{{\[[0-9]+:[0-9]+\]}}, v[[VAL]]
448define void @constant_sextload_i8_to_i16(i16 addrspace(1)* %out, i8 addrspace(2)* %in) #0 {
449  %a = load i8, i8 addrspace(2)* %in
450  %ext = sext i8 %a to i16
451  store i16 %ext, i16 addrspace(1)* %out
452  ret void
453}
454
455; FUNC-LABEL: {{^}}constant_zextload_v1i8_to_v1i16:
456define void @constant_zextload_v1i8_to_v1i16(<1 x i16> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
457  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
458  %ext = zext <1 x i8> %load to <1 x i16>
459  store <1 x i16> %ext, <1 x i16> addrspace(1)* %out
460  ret void
461}
462
463; FUNC-LABEL: {{^}}constant_sextload_v1i8_to_v1i16:
464define void @constant_sextload_v1i8_to_v1i16(<1 x i16> addrspace(1)* %out, <1 x i8> addrspace(2)* %in) #0 {
465  %load = load <1 x i8>, <1 x i8> addrspace(2)* %in
466  %ext = sext <1 x i8> %load to <1 x i16>
467  store <1 x i16> %ext, <1 x i16> addrspace(1)* %out
468  ret void
469}
470
471; FUNC-LABEL: {{^}}constant_zextload_v2i8_to_v2i16:
472define void @constant_zextload_v2i8_to_v2i16(<2 x i16> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
473  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
474  %ext = zext <2 x i8> %load to <2 x i16>
475  store <2 x i16> %ext, <2 x i16> addrspace(1)* %out
476  ret void
477}
478
479; FUNC-LABEL: {{^}}constant_sextload_v2i8_to_v2i16:
480define void @constant_sextload_v2i8_to_v2i16(<2 x i16> addrspace(1)* %out, <2 x i8> addrspace(2)* %in) #0 {
481  %load = load <2 x i8>, <2 x i8> addrspace(2)* %in
482  %ext = sext <2 x i8> %load to <2 x i16>
483  store <2 x i16> %ext, <2 x i16> addrspace(1)* %out
484  ret void
485}
486
487; FUNC-LABEL: {{^}}constant_zextload_v4i8_to_v4i16:
488define void @constant_zextload_v4i8_to_v4i16(<4 x i16> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
489  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
490  %ext = zext <4 x i8> %load to <4 x i16>
491  store <4 x i16> %ext, <4 x i16> addrspace(1)* %out
492  ret void
493}
494
495; FUNC-LABEL: {{^}}constant_sextload_v4i8_to_v4i16:
496define void @constant_sextload_v4i8_to_v4i16(<4 x i16> addrspace(1)* %out, <4 x i8> addrspace(2)* %in) #0 {
497  %load = load <4 x i8>, <4 x i8> addrspace(2)* %in
498  %ext = sext <4 x i8> %load to <4 x i16>
499  store <4 x i16> %ext, <4 x i16> addrspace(1)* %out
500  ret void
501}
502
503; FUNC-LABEL: {{^}}constant_zextload_v8i8_to_v8i16:
504define void @constant_zextload_v8i8_to_v8i16(<8 x i16> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
505  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
506  %ext = zext <8 x i8> %load to <8 x i16>
507  store <8 x i16> %ext, <8 x i16> addrspace(1)* %out
508  ret void
509}
510
511; FUNC-LABEL: {{^}}constant_sextload_v8i8_to_v8i16:
512define void @constant_sextload_v8i8_to_v8i16(<8 x i16> addrspace(1)* %out, <8 x i8> addrspace(2)* %in) #0 {
513  %load = load <8 x i8>, <8 x i8> addrspace(2)* %in
514  %ext = sext <8 x i8> %load to <8 x i16>
515  store <8 x i16> %ext, <8 x i16> addrspace(1)* %out
516  ret void
517}
518
519; FUNC-LABEL: {{^}}constant_zextload_v16i8_to_v16i16:
520define void @constant_zextload_v16i8_to_v16i16(<16 x i16> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
521  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
522  %ext = zext <16 x i8> %load to <16 x i16>
523  store <16 x i16> %ext, <16 x i16> addrspace(1)* %out
524  ret void
525}
526
527; FUNC-LABEL: {{^}}constant_sextload_v16i8_to_v16i16:
528define void @constant_sextload_v16i8_to_v16i16(<16 x i16> addrspace(1)* %out, <16 x i8> addrspace(2)* %in) #0 {
529  %load = load <16 x i8>, <16 x i8> addrspace(2)* %in
530  %ext = sext <16 x i8> %load to <16 x i16>
531  store <16 x i16> %ext, <16 x i16> addrspace(1)* %out
532  ret void
533}
534
535; FUNC-LABEL: {{^}}constant_zextload_v32i8_to_v32i16:
536define void @constant_zextload_v32i8_to_v32i16(<32 x i16> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
537  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
538  %ext = zext <32 x i8> %load to <32 x i16>
539  store <32 x i16> %ext, <32 x i16> addrspace(1)* %out
540  ret void
541}
542
543; FUNC-LABEL: {{^}}constant_sextload_v32i8_to_v32i16:
544define void @constant_sextload_v32i8_to_v32i16(<32 x i16> addrspace(1)* %out, <32 x i8> addrspace(2)* %in) #0 {
545  %load = load <32 x i8>, <32 x i8> addrspace(2)* %in
546  %ext = sext <32 x i8> %load to <32 x i16>
547  store <32 x i16> %ext, <32 x i16> addrspace(1)* %out
548  ret void
549}
550
551; XFUNC-LABEL: {{^}}constant_zextload_v64i8_to_v64i16:
552; define void @constant_zextload_v64i8_to_v64i16(<64 x i16> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
553;   %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
554;   %ext = zext <64 x i8> %load to <64 x i16>
555;   store <64 x i16> %ext, <64 x i16> addrspace(1)* %out
556;   ret void
557; }
558
559; XFUNC-LABEL: {{^}}constant_sextload_v64i8_to_v64i16:
560; define void @constant_sextload_v64i8_to_v64i16(<64 x i16> addrspace(1)* %out, <64 x i8> addrspace(2)* %in) #0 {
561;   %load = load <64 x i8>, <64 x i8> addrspace(2)* %in
562;   %ext = sext <64 x i8> %load to <64 x i16>
563;   store <64 x i16> %ext, <64 x i16> addrspace(1)* %out
564;   ret void
565; }
566
567attributes #0 = { nounwind }
568