• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
3; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4
5; FUNC-LABEL: {{^}}local_load_i1:
6; GCN: ds_read_u8
7; GCN: v_and_b32_e32 v{{[0-9]+}}, 1
8; GCN: ds_write_b8
9
10; EG: LDS_UBYTE_READ_RET
11; EG: AND_INT
12; EG: LDS_BYTE_WRITE
13define void @local_load_i1(i1 addrspace(3)* %out, i1 addrspace(3)* %in) #0 {
14  %load = load i1, i1 addrspace(3)* %in
15  store i1 %load, i1 addrspace(3)* %out
16  ret void
17}
18
19; FUNC-LABEL: {{^}}local_load_v2i1:
20define void @local_load_v2i1(<2 x i1> addrspace(3)* %out, <2 x i1> addrspace(3)* %in) #0 {
21  %load = load <2 x i1>, <2 x i1> addrspace(3)* %in
22  store <2 x i1> %load, <2 x i1> addrspace(3)* %out
23  ret void
24}
25
26; FUNC-LABEL: {{^}}local_load_v3i1:
27define void @local_load_v3i1(<3 x i1> addrspace(3)* %out, <3 x i1> addrspace(3)* %in) #0 {
28  %load = load <3 x i1>, <3 x i1> addrspace(3)* %in
29  store <3 x i1> %load, <3 x i1> addrspace(3)* %out
30  ret void
31}
32
33; FUNC-LABEL: {{^}}local_load_v4i1:
34define void @local_load_v4i1(<4 x i1> addrspace(3)* %out, <4 x i1> addrspace(3)* %in) #0 {
35  %load = load <4 x i1>, <4 x i1> addrspace(3)* %in
36  store <4 x i1> %load, <4 x i1> addrspace(3)* %out
37  ret void
38}
39
40; FUNC-LABEL: {{^}}local_load_v8i1:
41define void @local_load_v8i1(<8 x i1> addrspace(3)* %out, <8 x i1> addrspace(3)* %in) #0 {
42  %load = load <8 x i1>, <8 x i1> addrspace(3)* %in
43  store <8 x i1> %load, <8 x i1> addrspace(3)* %out
44  ret void
45}
46
47; FUNC-LABEL: {{^}}local_load_v16i1:
48define void @local_load_v16i1(<16 x i1> addrspace(3)* %out, <16 x i1> addrspace(3)* %in) #0 {
49  %load = load <16 x i1>, <16 x i1> addrspace(3)* %in
50  store <16 x i1> %load, <16 x i1> addrspace(3)* %out
51  ret void
52}
53
54; FUNC-LABEL: {{^}}local_load_v32i1:
55define void @local_load_v32i1(<32 x i1> addrspace(3)* %out, <32 x i1> addrspace(3)* %in) #0 {
56  %load = load <32 x i1>, <32 x i1> addrspace(3)* %in
57  store <32 x i1> %load, <32 x i1> addrspace(3)* %out
58  ret void
59}
60
61; FUNC-LABEL: {{^}}local_load_v64i1:
62define void @local_load_v64i1(<64 x i1> addrspace(3)* %out, <64 x i1> addrspace(3)* %in) #0 {
63  %load = load <64 x i1>, <64 x i1> addrspace(3)* %in
64  store <64 x i1> %load, <64 x i1> addrspace(3)* %out
65  ret void
66}
67
68; FUNC-LABEL: {{^}}local_zextload_i1_to_i32:
69; GCN: ds_read_u8
70; GCN: ds_write_b32
71define void @local_zextload_i1_to_i32(i32 addrspace(3)* %out, i1 addrspace(3)* %in) #0 {
72  %a = load i1, i1 addrspace(3)* %in
73  %ext = zext i1 %a to i32
74  store i32 %ext, i32 addrspace(3)* %out
75  ret void
76}
77
78; FUNC-LABEL: {{^}}local_sextload_i1_to_i32:
79; GCN: ds_read_u8
80; GCN: v_bfe_i32 {{v[0-9]+}}, {{v[0-9]+}}, 0, 1{{$}}
81; GCN: ds_write_b32
82
83; EG: LDS_UBYTE_READ_RET
84; EG: BFE_INT
85define void @local_sextload_i1_to_i32(i32 addrspace(3)* %out, i1 addrspace(3)* %in) #0 {
86  %a = load i1, i1 addrspace(3)* %in
87  %ext = sext i1 %a to i32
88  store i32 %ext, i32 addrspace(3)* %out
89  ret void
90}
91
92; FUNC-LABEL: {{^}}local_zextload_v1i1_to_v1i32:
93define void @local_zextload_v1i1_to_v1i32(<1 x i32> addrspace(3)* %out, <1 x i1> addrspace(3)* %in) #0 {
94  %load = load <1 x i1>, <1 x i1> addrspace(3)* %in
95  %ext = zext <1 x i1> %load to <1 x i32>
96  store <1 x i32> %ext, <1 x i32> addrspace(3)* %out
97  ret void
98}
99
100; FUNC-LABEL: {{^}}local_sextload_v1i1_to_v1i32:
101define void @local_sextload_v1i1_to_v1i32(<1 x i32> addrspace(3)* %out, <1 x i1> addrspace(3)* %in) #0 {
102  %load = load <1 x i1>, <1 x i1> addrspace(3)* %in
103  %ext = sext <1 x i1> %load to <1 x i32>
104  store <1 x i32> %ext, <1 x i32> addrspace(3)* %out
105  ret void
106}
107
108; FUNC-LABEL: {{^}}local_zextload_v2i1_to_v2i32:
109define void @local_zextload_v2i1_to_v2i32(<2 x i32> addrspace(3)* %out, <2 x i1> addrspace(3)* %in) #0 {
110  %load = load <2 x i1>, <2 x i1> addrspace(3)* %in
111  %ext = zext <2 x i1> %load to <2 x i32>
112  store <2 x i32> %ext, <2 x i32> addrspace(3)* %out
113  ret void
114}
115
116; FUNC-LABEL: {{^}}local_sextload_v2i1_to_v2i32:
117define void @local_sextload_v2i1_to_v2i32(<2 x i32> addrspace(3)* %out, <2 x i1> addrspace(3)* %in) #0 {
118  %load = load <2 x i1>, <2 x i1> addrspace(3)* %in
119  %ext = sext <2 x i1> %load to <2 x i32>
120  store <2 x i32> %ext, <2 x i32> addrspace(3)* %out
121  ret void
122}
123
124; FUNC-LABEL: {{^}}local_zextload_v3i1_to_v3i32:
125define void @local_zextload_v3i1_to_v3i32(<3 x i32> addrspace(3)* %out, <3 x i1> addrspace(3)* %in) #0 {
126  %load = load <3 x i1>, <3 x i1> addrspace(3)* %in
127  %ext = zext <3 x i1> %load to <3 x i32>
128  store <3 x i32> %ext, <3 x i32> addrspace(3)* %out
129  ret void
130}
131
132; FUNC-LABEL: {{^}}local_sextload_v3i1_to_v3i32:
133define void @local_sextload_v3i1_to_v3i32(<3 x i32> addrspace(3)* %out, <3 x i1> addrspace(3)* %in) #0 {
134  %load = load <3 x i1>, <3 x i1> addrspace(3)* %in
135  %ext = sext <3 x i1> %load to <3 x i32>
136  store <3 x i32> %ext, <3 x i32> addrspace(3)* %out
137  ret void
138}
139
140; FUNC-LABEL: {{^}}local_zextload_v4i1_to_v4i32:
141define void @local_zextload_v4i1_to_v4i32(<4 x i32> addrspace(3)* %out, <4 x i1> addrspace(3)* %in) #0 {
142  %load = load <4 x i1>, <4 x i1> addrspace(3)* %in
143  %ext = zext <4 x i1> %load to <4 x i32>
144  store <4 x i32> %ext, <4 x i32> addrspace(3)* %out
145  ret void
146}
147
148; FUNC-LABEL: {{^}}local_sextload_v4i1_to_v4i32:
149define void @local_sextload_v4i1_to_v4i32(<4 x i32> addrspace(3)* %out, <4 x i1> addrspace(3)* %in) #0 {
150  %load = load <4 x i1>, <4 x i1> addrspace(3)* %in
151  %ext = sext <4 x i1> %load to <4 x i32>
152  store <4 x i32> %ext, <4 x i32> addrspace(3)* %out
153  ret void
154}
155
156; FUNC-LABEL: {{^}}local_zextload_v8i1_to_v8i32:
157define void @local_zextload_v8i1_to_v8i32(<8 x i32> addrspace(3)* %out, <8 x i1> addrspace(3)* %in) #0 {
158  %load = load <8 x i1>, <8 x i1> addrspace(3)* %in
159  %ext = zext <8 x i1> %load to <8 x i32>
160  store <8 x i32> %ext, <8 x i32> addrspace(3)* %out
161  ret void
162}
163
164; FUNC-LABEL: {{^}}local_sextload_v8i1_to_v8i32:
165define void @local_sextload_v8i1_to_v8i32(<8 x i32> addrspace(3)* %out, <8 x i1> addrspace(3)* %in) #0 {
166  %load = load <8 x i1>, <8 x i1> addrspace(3)* %in
167  %ext = sext <8 x i1> %load to <8 x i32>
168  store <8 x i32> %ext, <8 x i32> addrspace(3)* %out
169  ret void
170}
171
172; FUNC-LABEL: {{^}}local_zextload_v16i1_to_v16i32:
173define void @local_zextload_v16i1_to_v16i32(<16 x i32> addrspace(3)* %out, <16 x i1> addrspace(3)* %in) #0 {
174  %load = load <16 x i1>, <16 x i1> addrspace(3)* %in
175  %ext = zext <16 x i1> %load to <16 x i32>
176  store <16 x i32> %ext, <16 x i32> addrspace(3)* %out
177  ret void
178}
179
180; FUNC-LABEL: {{^}}local_sextload_v16i1_to_v16i32:
181define void @local_sextload_v16i1_to_v16i32(<16 x i32> addrspace(3)* %out, <16 x i1> addrspace(3)* %in) #0 {
182  %load = load <16 x i1>, <16 x i1> addrspace(3)* %in
183  %ext = sext <16 x i1> %load to <16 x i32>
184  store <16 x i32> %ext, <16 x i32> addrspace(3)* %out
185  ret void
186}
187
188; FUNC-LABEL: {{^}}local_zextload_v32i1_to_v32i32:
189define void @local_zextload_v32i1_to_v32i32(<32 x i32> addrspace(3)* %out, <32 x i1> addrspace(3)* %in) #0 {
190  %load = load <32 x i1>, <32 x i1> addrspace(3)* %in
191  %ext = zext <32 x i1> %load to <32 x i32>
192  store <32 x i32> %ext, <32 x i32> addrspace(3)* %out
193  ret void
194}
195
196; FUNC-LABEL: {{^}}local_sextload_v32i1_to_v32i32:
197define void @local_sextload_v32i1_to_v32i32(<32 x i32> addrspace(3)* %out, <32 x i1> addrspace(3)* %in) #0 {
198  %load = load <32 x i1>, <32 x i1> addrspace(3)* %in
199  %ext = sext <32 x i1> %load to <32 x i32>
200  store <32 x i32> %ext, <32 x i32> addrspace(3)* %out
201  ret void
202}
203
204; FUNC-LABEL: {{^}}local_zextload_v64i1_to_v64i32:
205define void @local_zextload_v64i1_to_v64i32(<64 x i32> addrspace(3)* %out, <64 x i1> addrspace(3)* %in) #0 {
206  %load = load <64 x i1>, <64 x i1> addrspace(3)* %in
207  %ext = zext <64 x i1> %load to <64 x i32>
208  store <64 x i32> %ext, <64 x i32> addrspace(3)* %out
209  ret void
210}
211
212; FUNC-LABEL: {{^}}local_sextload_v64i1_to_v64i32:
213define void @local_sextload_v64i1_to_v64i32(<64 x i32> addrspace(3)* %out, <64 x i1> addrspace(3)* %in) #0 {
214  %load = load <64 x i1>, <64 x i1> addrspace(3)* %in
215  %ext = sext <64 x i1> %load to <64 x i32>
216  store <64 x i32> %ext, <64 x i32> addrspace(3)* %out
217  ret void
218}
219
220; FUNC-LABEL: {{^}}local_zextload_i1_to_i64:
221; GCN-DAG: ds_read_u8 [[LOAD:v[0-9]+]],
222; GCN-DAG: v_mov_b32_e32 {{v[0-9]+}}, 0{{$}}
223; GCN: ds_write_b64
224define void @local_zextload_i1_to_i64(i64 addrspace(3)* %out, i1 addrspace(3)* %in) #0 {
225  %a = load i1, i1 addrspace(3)* %in
226  %ext = zext i1 %a to i64
227  store i64 %ext, i64 addrspace(3)* %out
228  ret void
229}
230
231; FUNC-LABEL: {{^}}local_sextload_i1_to_i64:
232; GCN: ds_read_u8 [[LOAD:v[0-9]+]],
233; GCN: v_bfe_i32 [[BFE:v[0-9]+]], {{v[0-9]+}}, 0, 1{{$}}
234; GCN: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, [[BFE]]
235; GCN: ds_write_b64
236define void @local_sextload_i1_to_i64(i64 addrspace(3)* %out, i1 addrspace(3)* %in) #0 {
237  %a = load i1, i1 addrspace(3)* %in
238  %ext = sext i1 %a to i64
239  store i64 %ext, i64 addrspace(3)* %out
240  ret void
241}
242
243; FUNC-LABEL: {{^}}local_zextload_v1i1_to_v1i64:
244define void @local_zextload_v1i1_to_v1i64(<1 x i64> addrspace(3)* %out, <1 x i1> addrspace(3)* %in) #0 {
245  %load = load <1 x i1>, <1 x i1> addrspace(3)* %in
246  %ext = zext <1 x i1> %load to <1 x i64>
247  store <1 x i64> %ext, <1 x i64> addrspace(3)* %out
248  ret void
249}
250
251; FUNC-LABEL: {{^}}local_sextload_v1i1_to_v1i64:
252define void @local_sextload_v1i1_to_v1i64(<1 x i64> addrspace(3)* %out, <1 x i1> addrspace(3)* %in) #0 {
253  %load = load <1 x i1>, <1 x i1> addrspace(3)* %in
254  %ext = sext <1 x i1> %load to <1 x i64>
255  store <1 x i64> %ext, <1 x i64> addrspace(3)* %out
256  ret void
257}
258
259; FUNC-LABEL: {{^}}local_zextload_v2i1_to_v2i64:
260define void @local_zextload_v2i1_to_v2i64(<2 x i64> addrspace(3)* %out, <2 x i1> addrspace(3)* %in) #0 {
261  %load = load <2 x i1>, <2 x i1> addrspace(3)* %in
262  %ext = zext <2 x i1> %load to <2 x i64>
263  store <2 x i64> %ext, <2 x i64> addrspace(3)* %out
264  ret void
265}
266
267; FUNC-LABEL: {{^}}local_sextload_v2i1_to_v2i64:
268define void @local_sextload_v2i1_to_v2i64(<2 x i64> addrspace(3)* %out, <2 x i1> addrspace(3)* %in) #0 {
269  %load = load <2 x i1>, <2 x i1> addrspace(3)* %in
270  %ext = sext <2 x i1> %load to <2 x i64>
271  store <2 x i64> %ext, <2 x i64> addrspace(3)* %out
272  ret void
273}
274
275; FUNC-LABEL: {{^}}local_zextload_v3i1_to_v3i64:
276define void @local_zextload_v3i1_to_v3i64(<3 x i64> addrspace(3)* %out, <3 x i1> addrspace(3)* %in) #0 {
277  %load = load <3 x i1>, <3 x i1> addrspace(3)* %in
278  %ext = zext <3 x i1> %load to <3 x i64>
279  store <3 x i64> %ext, <3 x i64> addrspace(3)* %out
280  ret void
281}
282
283; FUNC-LABEL: {{^}}local_sextload_v3i1_to_v3i64:
284define void @local_sextload_v3i1_to_v3i64(<3 x i64> addrspace(3)* %out, <3 x i1> addrspace(3)* %in) #0 {
285  %load = load <3 x i1>, <3 x i1> addrspace(3)* %in
286  %ext = sext <3 x i1> %load to <3 x i64>
287  store <3 x i64> %ext, <3 x i64> addrspace(3)* %out
288  ret void
289}
290
291; FUNC-LABEL: {{^}}local_zextload_v4i1_to_v4i64:
292define void @local_zextload_v4i1_to_v4i64(<4 x i64> addrspace(3)* %out, <4 x i1> addrspace(3)* %in) #0 {
293  %load = load <4 x i1>, <4 x i1> addrspace(3)* %in
294  %ext = zext <4 x i1> %load to <4 x i64>
295  store <4 x i64> %ext, <4 x i64> addrspace(3)* %out
296  ret void
297}
298
299; FUNC-LABEL: {{^}}local_sextload_v4i1_to_v4i64:
300define void @local_sextload_v4i1_to_v4i64(<4 x i64> addrspace(3)* %out, <4 x i1> addrspace(3)* %in) #0 {
301  %load = load <4 x i1>, <4 x i1> addrspace(3)* %in
302  %ext = sext <4 x i1> %load to <4 x i64>
303  store <4 x i64> %ext, <4 x i64> addrspace(3)* %out
304  ret void
305}
306
307; FUNC-LABEL: {{^}}local_zextload_v8i1_to_v8i64:
308define void @local_zextload_v8i1_to_v8i64(<8 x i64> addrspace(3)* %out, <8 x i1> addrspace(3)* %in) #0 {
309  %load = load <8 x i1>, <8 x i1> addrspace(3)* %in
310  %ext = zext <8 x i1> %load to <8 x i64>
311  store <8 x i64> %ext, <8 x i64> addrspace(3)* %out
312  ret void
313}
314
315; FUNC-LABEL: {{^}}local_sextload_v8i1_to_v8i64:
316define void @local_sextload_v8i1_to_v8i64(<8 x i64> addrspace(3)* %out, <8 x i1> addrspace(3)* %in) #0 {
317  %load = load <8 x i1>, <8 x i1> addrspace(3)* %in
318  %ext = sext <8 x i1> %load to <8 x i64>
319  store <8 x i64> %ext, <8 x i64> addrspace(3)* %out
320  ret void
321}
322
323; FUNC-LABEL: {{^}}local_zextload_v16i1_to_v16i64:
324define void @local_zextload_v16i1_to_v16i64(<16 x i64> addrspace(3)* %out, <16 x i1> addrspace(3)* %in) #0 {
325  %load = load <16 x i1>, <16 x i1> addrspace(3)* %in
326  %ext = zext <16 x i1> %load to <16 x i64>
327  store <16 x i64> %ext, <16 x i64> addrspace(3)* %out
328  ret void
329}
330
331; FUNC-LABEL: {{^}}local_sextload_v16i1_to_v16i64:
332define void @local_sextload_v16i1_to_v16i64(<16 x i64> addrspace(3)* %out, <16 x i1> addrspace(3)* %in) #0 {
333  %load = load <16 x i1>, <16 x i1> addrspace(3)* %in
334  %ext = sext <16 x i1> %load to <16 x i64>
335  store <16 x i64> %ext, <16 x i64> addrspace(3)* %out
336  ret void
337}
338
339; FUNC-LABEL: {{^}}local_zextload_v32i1_to_v32i64:
340define void @local_zextload_v32i1_to_v32i64(<32 x i64> addrspace(3)* %out, <32 x i1> addrspace(3)* %in) #0 {
341  %load = load <32 x i1>, <32 x i1> addrspace(3)* %in
342  %ext = zext <32 x i1> %load to <32 x i64>
343  store <32 x i64> %ext, <32 x i64> addrspace(3)* %out
344  ret void
345}
346
347; FUNC-LABEL: {{^}}local_sextload_v32i1_to_v32i64:
348define void @local_sextload_v32i1_to_v32i64(<32 x i64> addrspace(3)* %out, <32 x i1> addrspace(3)* %in) #0 {
349  %load = load <32 x i1>, <32 x i1> addrspace(3)* %in
350  %ext = sext <32 x i1> %load to <32 x i64>
351  store <32 x i64> %ext, <32 x i64> addrspace(3)* %out
352  ret void
353}
354
355; FUNC-LABEL: {{^}}local_zextload_v64i1_to_v64i64:
356define void @local_zextload_v64i1_to_v64i64(<64 x i64> addrspace(3)* %out, <64 x i1> addrspace(3)* %in) #0 {
357  %load = load <64 x i1>, <64 x i1> addrspace(3)* %in
358  %ext = zext <64 x i1> %load to <64 x i64>
359  store <64 x i64> %ext, <64 x i64> addrspace(3)* %out
360  ret void
361}
362
363; FUNC-LABEL: {{^}}local_sextload_v64i1_to_v64i64:
364define void @local_sextload_v64i1_to_v64i64(<64 x i64> addrspace(3)* %out, <64 x i1> addrspace(3)* %in) #0 {
365  %load = load <64 x i1>, <64 x i1> addrspace(3)* %in
366  %ext = sext <64 x i1> %load to <64 x i64>
367  store <64 x i64> %ext, <64 x i64> addrspace(3)* %out
368  ret void
369}
370
371attributes #0 = { nounwind }
372