1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; ## Support i16x2 instructions
3 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_90 -mattr=+ptx80 \
4 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
5 ; RUN: | FileCheck -allow-deprecated-dag-overlap %s
7 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_90 \
8 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
9 ; RUN: | %ptxas-verify -arch=sm_90 \
12 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
14 define <4 x i8> @test_ret_const() #0 {
15 ; CHECK-LABEL: test_ret_const(
17 ; CHECK-NEXT: .reg .b32 %r<2>;
19 ; CHECK-NEXT: // %bb.0:
20 ; CHECK-NEXT: mov.b32 %r1, -66911489;
21 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r1;
23 ret <4 x i8> <i8 -1, i8 2, i8 3, i8 -4>
26 define i8 @test_extract_0(<4 x i8> %a) #0 {
27 ; CHECK-LABEL: test_extract_0(
29 ; CHECK-NEXT: .reg .b32 %r<3>;
31 ; CHECK-NEXT: // %bb.0:
32 ; CHECK-NEXT: ld.param.u32 %r1, [test_extract_0_param_0];
33 ; CHECK-NEXT: bfe.u32 %r2, %r1, 0, 8;
34 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
36 %e = extractelement <4 x i8> %a, i32 0
40 define i8 @test_extract_1(<4 x i8> %a) #0 {
41 ; CHECK-LABEL: test_extract_1(
43 ; CHECK-NEXT: .reg .b32 %r<3>;
45 ; CHECK-NEXT: // %bb.0:
46 ; CHECK-NEXT: ld.param.u32 %r1, [test_extract_1_param_0];
47 ; CHECK-NEXT: bfe.u32 %r2, %r1, 8, 8;
48 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
50 %e = extractelement <4 x i8> %a, i32 1
54 define i8 @test_extract_2(<4 x i8> %a) #0 {
55 ; CHECK-LABEL: test_extract_2(
57 ; CHECK-NEXT: .reg .b32 %r<3>;
59 ; CHECK-NEXT: // %bb.0:
60 ; CHECK-NEXT: ld.param.u32 %r1, [test_extract_2_param_0];
61 ; CHECK-NEXT: bfe.u32 %r2, %r1, 16, 8;
62 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
64 %e = extractelement <4 x i8> %a, i32 2
68 define i8 @test_extract_3(<4 x i8> %a) #0 {
69 ; CHECK-LABEL: test_extract_3(
71 ; CHECK-NEXT: .reg .b32 %r<3>;
73 ; CHECK-NEXT: // %bb.0:
74 ; CHECK-NEXT: ld.param.u32 %r1, [test_extract_3_param_0];
75 ; CHECK-NEXT: bfe.u32 %r2, %r1, 24, 8;
76 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
78 %e = extractelement <4 x i8> %a, i32 3
82 define i8 @test_extract_i(<4 x i8> %a, i64 %idx) #0 {
83 ; CHECK-LABEL: test_extract_i(
85 ; CHECK-NEXT: .reg .b32 %r<5>;
86 ; CHECK-NEXT: .reg .b64 %rd<2>;
88 ; CHECK-NEXT: // %bb.0:
89 ; CHECK-NEXT: ld.param.u64 %rd1, [test_extract_i_param_1];
90 ; CHECK-NEXT: ld.param.u32 %r1, [test_extract_i_param_0];
91 ; CHECK-NEXT: cvt.u32.u64 %r2, %rd1;
92 ; CHECK-NEXT: shl.b32 %r3, %r2, 3;
93 ; CHECK-NEXT: bfe.u32 %r4, %r1, %r3, 8;
94 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r4;
96 %e = extractelement <4 x i8> %a, i64 %idx
100 define <4 x i8> @test_add(<4 x i8> %a, <4 x i8> %b) #0 {
101 ; CHECK-LABEL: test_add(
103 ; CHECK-NEXT: .reg .b16 %rs<13>;
104 ; CHECK-NEXT: .reg .b32 %r<19>;
106 ; CHECK-NEXT: // %bb.0:
107 ; CHECK-NEXT: ld.param.u32 %r2, [test_add_param_1];
108 ; CHECK-NEXT: ld.param.u32 %r1, [test_add_param_0];
109 ; CHECK-NEXT: bfe.u32 %r3, %r2, 0, 8;
110 ; CHECK-NEXT: cvt.u16.u32 %rs1, %r3;
111 ; CHECK-NEXT: bfe.u32 %r4, %r1, 0, 8;
112 ; CHECK-NEXT: cvt.u16.u32 %rs2, %r4;
113 ; CHECK-NEXT: add.s16 %rs3, %rs2, %rs1;
114 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs3;
115 ; CHECK-NEXT: bfe.u32 %r6, %r2, 8, 8;
116 ; CHECK-NEXT: cvt.u16.u32 %rs4, %r6;
117 ; CHECK-NEXT: bfe.u32 %r7, %r1, 8, 8;
118 ; CHECK-NEXT: cvt.u16.u32 %rs5, %r7;
119 ; CHECK-NEXT: add.s16 %rs6, %rs5, %rs4;
120 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
121 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r5, 8, 8;
122 ; CHECK-NEXT: bfe.u32 %r10, %r2, 16, 8;
123 ; CHECK-NEXT: cvt.u16.u32 %rs7, %r10;
124 ; CHECK-NEXT: bfe.u32 %r11, %r1, 16, 8;
125 ; CHECK-NEXT: cvt.u16.u32 %rs8, %r11;
126 ; CHECK-NEXT: add.s16 %rs9, %rs8, %rs7;
127 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs9;
128 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r9, 16, 8;
129 ; CHECK-NEXT: bfe.u32 %r14, %r2, 24, 8;
130 ; CHECK-NEXT: cvt.u16.u32 %rs10, %r14;
131 ; CHECK-NEXT: bfe.u32 %r15, %r1, 24, 8;
132 ; CHECK-NEXT: cvt.u16.u32 %rs11, %r15;
133 ; CHECK-NEXT: add.s16 %rs12, %rs11, %rs10;
134 ; CHECK-NEXT: cvt.u32.u16 %r16, %rs12;
135 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r13, 24, 8;
136 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r17;
138 %r = add <4 x i8> %a, %b
142 define <4 x i8> @test_add_imm_0(<4 x i8> %a) #0 {
143 ; CHECK-LABEL: test_add_imm_0(
145 ; CHECK-NEXT: .reg .b16 %rs<9>;
146 ; CHECK-NEXT: .reg .b32 %r<14>;
148 ; CHECK-NEXT: // %bb.0:
149 ; CHECK-NEXT: ld.param.u32 %r1, [test_add_imm_0_param_0];
150 ; CHECK-NEXT: bfe.u32 %r2, %r1, 0, 8;
151 ; CHECK-NEXT: cvt.u16.u32 %rs1, %r2;
152 ; CHECK-NEXT: add.s16 %rs2, %rs1, 1;
153 ; CHECK-NEXT: cvt.u32.u16 %r3, %rs2;
154 ; CHECK-NEXT: bfe.u32 %r4, %r1, 8, 8;
155 ; CHECK-NEXT: cvt.u16.u32 %rs3, %r4;
156 ; CHECK-NEXT: add.s16 %rs4, %rs3, 2;
157 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs4;
158 ; CHECK-NEXT: bfi.b32 %r6, %r5, %r3, 8, 8;
159 ; CHECK-NEXT: bfe.u32 %r7, %r1, 16, 8;
160 ; CHECK-NEXT: cvt.u16.u32 %rs5, %r7;
161 ; CHECK-NEXT: add.s16 %rs6, %rs5, 3;
162 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
163 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r6, 16, 8;
164 ; CHECK-NEXT: bfe.u32 %r10, %r1, 24, 8;
165 ; CHECK-NEXT: cvt.u16.u32 %rs7, %r10;
166 ; CHECK-NEXT: add.s16 %rs8, %rs7, 4;
167 ; CHECK-NEXT: cvt.u32.u16 %r11, %rs8;
168 ; CHECK-NEXT: bfi.b32 %r12, %r11, %r9, 24, 8;
169 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r12;
171 %r = add <4 x i8> <i8 1, i8 2, i8 3, i8 4>, %a
175 define <4 x i8> @test_add_imm_1(<4 x i8> %a) #0 {
176 ; CHECK-LABEL: test_add_imm_1(
178 ; CHECK-NEXT: .reg .b16 %rs<9>;
179 ; CHECK-NEXT: .reg .b32 %r<14>;
181 ; CHECK-NEXT: // %bb.0:
182 ; CHECK-NEXT: ld.param.u32 %r1, [test_add_imm_1_param_0];
183 ; CHECK-NEXT: bfe.u32 %r2, %r1, 0, 8;
184 ; CHECK-NEXT: cvt.u16.u32 %rs1, %r2;
185 ; CHECK-NEXT: add.s16 %rs2, %rs1, 1;
186 ; CHECK-NEXT: cvt.u32.u16 %r3, %rs2;
187 ; CHECK-NEXT: bfe.u32 %r4, %r1, 8, 8;
188 ; CHECK-NEXT: cvt.u16.u32 %rs3, %r4;
189 ; CHECK-NEXT: add.s16 %rs4, %rs3, 2;
190 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs4;
191 ; CHECK-NEXT: bfi.b32 %r6, %r5, %r3, 8, 8;
192 ; CHECK-NEXT: bfe.u32 %r7, %r1, 16, 8;
193 ; CHECK-NEXT: cvt.u16.u32 %rs5, %r7;
194 ; CHECK-NEXT: add.s16 %rs6, %rs5, 3;
195 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
196 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r6, 16, 8;
197 ; CHECK-NEXT: bfe.u32 %r10, %r1, 24, 8;
198 ; CHECK-NEXT: cvt.u16.u32 %rs7, %r10;
199 ; CHECK-NEXT: add.s16 %rs8, %rs7, 4;
200 ; CHECK-NEXT: cvt.u32.u16 %r11, %rs8;
201 ; CHECK-NEXT: bfi.b32 %r12, %r11, %r9, 24, 8;
202 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r12;
204 %r = add <4 x i8> %a, <i8 1, i8 2, i8 3, i8 4>
208 define <4 x i8> @test_sub(<4 x i8> %a, <4 x i8> %b) #0 {
209 ; CHECK-LABEL: test_sub(
211 ; CHECK-NEXT: .reg .b16 %rs<13>;
212 ; CHECK-NEXT: .reg .b32 %r<19>;
214 ; CHECK-NEXT: // %bb.0:
215 ; CHECK-NEXT: ld.param.u32 %r2, [test_sub_param_1];
216 ; CHECK-NEXT: ld.param.u32 %r1, [test_sub_param_0];
217 ; CHECK-NEXT: bfe.u32 %r3, %r2, 0, 8;
218 ; CHECK-NEXT: cvt.u16.u32 %rs1, %r3;
219 ; CHECK-NEXT: bfe.u32 %r4, %r1, 0, 8;
220 ; CHECK-NEXT: cvt.u16.u32 %rs2, %r4;
221 ; CHECK-NEXT: sub.s16 %rs3, %rs2, %rs1;
222 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs3;
223 ; CHECK-NEXT: bfe.u32 %r6, %r2, 8, 8;
224 ; CHECK-NEXT: cvt.u16.u32 %rs4, %r6;
225 ; CHECK-NEXT: bfe.u32 %r7, %r1, 8, 8;
226 ; CHECK-NEXT: cvt.u16.u32 %rs5, %r7;
227 ; CHECK-NEXT: sub.s16 %rs6, %rs5, %rs4;
228 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
229 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r5, 8, 8;
230 ; CHECK-NEXT: bfe.u32 %r10, %r2, 16, 8;
231 ; CHECK-NEXT: cvt.u16.u32 %rs7, %r10;
232 ; CHECK-NEXT: bfe.u32 %r11, %r1, 16, 8;
233 ; CHECK-NEXT: cvt.u16.u32 %rs8, %r11;
234 ; CHECK-NEXT: sub.s16 %rs9, %rs8, %rs7;
235 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs9;
236 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r9, 16, 8;
237 ; CHECK-NEXT: bfe.u32 %r14, %r2, 24, 8;
238 ; CHECK-NEXT: cvt.u16.u32 %rs10, %r14;
239 ; CHECK-NEXT: bfe.u32 %r15, %r1, 24, 8;
240 ; CHECK-NEXT: cvt.u16.u32 %rs11, %r15;
241 ; CHECK-NEXT: sub.s16 %rs12, %rs11, %rs10;
242 ; CHECK-NEXT: cvt.u32.u16 %r16, %rs12;
243 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r13, 24, 8;
244 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r17;
246 %r = sub <4 x i8> %a, %b
250 define <4 x i8> @test_smax(<4 x i8> %a, <4 x i8> %b) #0 {
251 ; CHECK-LABEL: test_smax(
253 ; CHECK-NEXT: .reg .pred %p<5>;
254 ; CHECK-NEXT: .reg .b32 %r<27>;
256 ; CHECK-NEXT: // %bb.0:
257 ; CHECK-NEXT: ld.param.u32 %r2, [test_smax_param_1];
258 ; CHECK-NEXT: ld.param.u32 %r1, [test_smax_param_0];
259 ; CHECK-NEXT: bfe.s32 %r3, %r2, 24, 8;
260 ; CHECK-NEXT: bfe.s32 %r4, %r1, 24, 8;
261 ; CHECK-NEXT: setp.gt.s32 %p1, %r4, %r3;
262 ; CHECK-NEXT: bfe.s32 %r5, %r2, 16, 8;
263 ; CHECK-NEXT: bfe.s32 %r6, %r1, 16, 8;
264 ; CHECK-NEXT: setp.gt.s32 %p2, %r6, %r5;
265 ; CHECK-NEXT: bfe.s32 %r7, %r2, 8, 8;
266 ; CHECK-NEXT: bfe.s32 %r8, %r1, 8, 8;
267 ; CHECK-NEXT: setp.gt.s32 %p3, %r8, %r7;
268 ; CHECK-NEXT: bfe.s32 %r9, %r2, 0, 8;
269 ; CHECK-NEXT: bfe.s32 %r10, %r1, 0, 8;
270 ; CHECK-NEXT: setp.gt.s32 %p4, %r10, %r9;
271 ; CHECK-NEXT: bfe.u32 %r11, %r1, 24, 8;
272 ; CHECK-NEXT: bfe.u32 %r12, %r1, 16, 8;
273 ; CHECK-NEXT: bfe.u32 %r13, %r1, 8, 8;
274 ; CHECK-NEXT: bfe.u32 %r14, %r1, 0, 8;
275 ; CHECK-NEXT: bfe.u32 %r15, %r2, 0, 8;
276 ; CHECK-NEXT: selp.b32 %r16, %r14, %r15, %p4;
277 ; CHECK-NEXT: bfe.u32 %r17, %r2, 8, 8;
278 ; CHECK-NEXT: selp.b32 %r18, %r13, %r17, %p3;
279 ; CHECK-NEXT: bfi.b32 %r19, %r18, %r16, 8, 8;
280 ; CHECK-NEXT: bfe.u32 %r20, %r2, 16, 8;
281 ; CHECK-NEXT: selp.b32 %r21, %r12, %r20, %p2;
282 ; CHECK-NEXT: bfi.b32 %r22, %r21, %r19, 16, 8;
283 ; CHECK-NEXT: bfe.u32 %r23, %r2, 24, 8;
284 ; CHECK-NEXT: selp.b32 %r24, %r11, %r23, %p1;
285 ; CHECK-NEXT: bfi.b32 %r25, %r24, %r22, 24, 8;
286 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r25;
288 %cmp = icmp sgt <4 x i8> %a, %b
289 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %b
293 define <4 x i8> @test_umax(<4 x i8> %a, <4 x i8> %b) #0 {
294 ; CHECK-LABEL: test_umax(
296 ; CHECK-NEXT: .reg .pred %p<5>;
297 ; CHECK-NEXT: .reg .b32 %r<19>;
299 ; CHECK-NEXT: // %bb.0:
300 ; CHECK-NEXT: ld.param.u32 %r2, [test_umax_param_1];
301 ; CHECK-NEXT: ld.param.u32 %r1, [test_umax_param_0];
302 ; CHECK-NEXT: bfe.u32 %r3, %r2, 24, 8;
303 ; CHECK-NEXT: bfe.u32 %r4, %r1, 24, 8;
304 ; CHECK-NEXT: setp.hi.u32 %p1, %r4, %r3;
305 ; CHECK-NEXT: bfe.u32 %r5, %r2, 16, 8;
306 ; CHECK-NEXT: bfe.u32 %r6, %r1, 16, 8;
307 ; CHECK-NEXT: setp.hi.u32 %p2, %r6, %r5;
308 ; CHECK-NEXT: bfe.u32 %r7, %r2, 8, 8;
309 ; CHECK-NEXT: bfe.u32 %r8, %r1, 8, 8;
310 ; CHECK-NEXT: setp.hi.u32 %p3, %r8, %r7;
311 ; CHECK-NEXT: bfe.u32 %r9, %r2, 0, 8;
312 ; CHECK-NEXT: bfe.u32 %r10, %r1, 0, 8;
313 ; CHECK-NEXT: setp.hi.u32 %p4, %r10, %r9;
314 ; CHECK-NEXT: selp.b32 %r11, %r10, %r9, %p4;
315 ; CHECK-NEXT: selp.b32 %r12, %r8, %r7, %p3;
316 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r11, 8, 8;
317 ; CHECK-NEXT: selp.b32 %r14, %r6, %r5, %p2;
318 ; CHECK-NEXT: bfi.b32 %r15, %r14, %r13, 16, 8;
319 ; CHECK-NEXT: selp.b32 %r16, %r4, %r3, %p1;
320 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r15, 24, 8;
321 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r17;
323 %cmp = icmp ugt <4 x i8> %a, %b
324 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %b
328 define <4 x i8> @test_smin(<4 x i8> %a, <4 x i8> %b) #0 {
329 ; CHECK-LABEL: test_smin(
331 ; CHECK-NEXT: .reg .pred %p<5>;
332 ; CHECK-NEXT: .reg .b32 %r<27>;
334 ; CHECK-NEXT: // %bb.0:
335 ; CHECK-NEXT: ld.param.u32 %r2, [test_smin_param_1];
336 ; CHECK-NEXT: ld.param.u32 %r1, [test_smin_param_0];
337 ; CHECK-NEXT: bfe.s32 %r3, %r2, 24, 8;
338 ; CHECK-NEXT: bfe.s32 %r4, %r1, 24, 8;
339 ; CHECK-NEXT: setp.le.s32 %p1, %r4, %r3;
340 ; CHECK-NEXT: bfe.s32 %r5, %r2, 16, 8;
341 ; CHECK-NEXT: bfe.s32 %r6, %r1, 16, 8;
342 ; CHECK-NEXT: setp.le.s32 %p2, %r6, %r5;
343 ; CHECK-NEXT: bfe.s32 %r7, %r2, 8, 8;
344 ; CHECK-NEXT: bfe.s32 %r8, %r1, 8, 8;
345 ; CHECK-NEXT: setp.le.s32 %p3, %r8, %r7;
346 ; CHECK-NEXT: bfe.s32 %r9, %r2, 0, 8;
347 ; CHECK-NEXT: bfe.s32 %r10, %r1, 0, 8;
348 ; CHECK-NEXT: setp.le.s32 %p4, %r10, %r9;
349 ; CHECK-NEXT: bfe.u32 %r11, %r1, 24, 8;
350 ; CHECK-NEXT: bfe.u32 %r12, %r1, 16, 8;
351 ; CHECK-NEXT: bfe.u32 %r13, %r1, 8, 8;
352 ; CHECK-NEXT: bfe.u32 %r14, %r1, 0, 8;
353 ; CHECK-NEXT: bfe.u32 %r15, %r2, 0, 8;
354 ; CHECK-NEXT: selp.b32 %r16, %r14, %r15, %p4;
355 ; CHECK-NEXT: bfe.u32 %r17, %r2, 8, 8;
356 ; CHECK-NEXT: selp.b32 %r18, %r13, %r17, %p3;
357 ; CHECK-NEXT: bfi.b32 %r19, %r18, %r16, 8, 8;
358 ; CHECK-NEXT: bfe.u32 %r20, %r2, 16, 8;
359 ; CHECK-NEXT: selp.b32 %r21, %r12, %r20, %p2;
360 ; CHECK-NEXT: bfi.b32 %r22, %r21, %r19, 16, 8;
361 ; CHECK-NEXT: bfe.u32 %r23, %r2, 24, 8;
362 ; CHECK-NEXT: selp.b32 %r24, %r11, %r23, %p1;
363 ; CHECK-NEXT: bfi.b32 %r25, %r24, %r22, 24, 8;
364 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r25;
366 %cmp = icmp sle <4 x i8> %a, %b
367 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %b
371 define <4 x i8> @test_umin(<4 x i8> %a, <4 x i8> %b) #0 {
372 ; CHECK-LABEL: test_umin(
374 ; CHECK-NEXT: .reg .pred %p<5>;
375 ; CHECK-NEXT: .reg .b32 %r<19>;
377 ; CHECK-NEXT: // %bb.0:
378 ; CHECK-NEXT: ld.param.u32 %r2, [test_umin_param_1];
379 ; CHECK-NEXT: ld.param.u32 %r1, [test_umin_param_0];
380 ; CHECK-NEXT: bfe.u32 %r3, %r2, 24, 8;
381 ; CHECK-NEXT: bfe.u32 %r4, %r1, 24, 8;
382 ; CHECK-NEXT: setp.ls.u32 %p1, %r4, %r3;
383 ; CHECK-NEXT: bfe.u32 %r5, %r2, 16, 8;
384 ; CHECK-NEXT: bfe.u32 %r6, %r1, 16, 8;
385 ; CHECK-NEXT: setp.ls.u32 %p2, %r6, %r5;
386 ; CHECK-NEXT: bfe.u32 %r7, %r2, 8, 8;
387 ; CHECK-NEXT: bfe.u32 %r8, %r1, 8, 8;
388 ; CHECK-NEXT: setp.ls.u32 %p3, %r8, %r7;
389 ; CHECK-NEXT: bfe.u32 %r9, %r2, 0, 8;
390 ; CHECK-NEXT: bfe.u32 %r10, %r1, 0, 8;
391 ; CHECK-NEXT: setp.ls.u32 %p4, %r10, %r9;
392 ; CHECK-NEXT: selp.b32 %r11, %r10, %r9, %p4;
393 ; CHECK-NEXT: selp.b32 %r12, %r8, %r7, %p3;
394 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r11, 8, 8;
395 ; CHECK-NEXT: selp.b32 %r14, %r6, %r5, %p2;
396 ; CHECK-NEXT: bfi.b32 %r15, %r14, %r13, 16, 8;
397 ; CHECK-NEXT: selp.b32 %r16, %r4, %r3, %p1;
398 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r15, 24, 8;
399 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r17;
401 %cmp = icmp ule <4 x i8> %a, %b
402 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %b
406 define <4 x i8> @test_eq(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c) #0 {
407 ; CHECK-LABEL: test_eq(
409 ; CHECK-NEXT: .reg .pred %p<5>;
410 ; CHECK-NEXT: .reg .b32 %r<24>;
412 ; CHECK-NEXT: // %bb.0:
413 ; CHECK-NEXT: ld.param.u32 %r3, [test_eq_param_2];
414 ; CHECK-NEXT: ld.param.u32 %r2, [test_eq_param_1];
415 ; CHECK-NEXT: ld.param.u32 %r1, [test_eq_param_0];
416 ; CHECK-NEXT: bfe.u32 %r4, %r2, 24, 8;
417 ; CHECK-NEXT: bfe.u32 %r5, %r1, 24, 8;
418 ; CHECK-NEXT: setp.eq.u32 %p1, %r5, %r4;
419 ; CHECK-NEXT: bfe.u32 %r6, %r2, 16, 8;
420 ; CHECK-NEXT: bfe.u32 %r7, %r1, 16, 8;
421 ; CHECK-NEXT: setp.eq.u32 %p2, %r7, %r6;
422 ; CHECK-NEXT: bfe.u32 %r8, %r2, 8, 8;
423 ; CHECK-NEXT: bfe.u32 %r9, %r1, 8, 8;
424 ; CHECK-NEXT: setp.eq.u32 %p3, %r9, %r8;
425 ; CHECK-NEXT: bfe.u32 %r10, %r2, 0, 8;
426 ; CHECK-NEXT: bfe.u32 %r11, %r1, 0, 8;
427 ; CHECK-NEXT: setp.eq.u32 %p4, %r11, %r10;
428 ; CHECK-NEXT: bfe.u32 %r12, %r3, 0, 8;
429 ; CHECK-NEXT: selp.b32 %r13, %r11, %r12, %p4;
430 ; CHECK-NEXT: bfe.u32 %r14, %r3, 8, 8;
431 ; CHECK-NEXT: selp.b32 %r15, %r9, %r14, %p3;
432 ; CHECK-NEXT: bfi.b32 %r16, %r15, %r13, 8, 8;
433 ; CHECK-NEXT: bfe.u32 %r17, %r3, 16, 8;
434 ; CHECK-NEXT: selp.b32 %r18, %r7, %r17, %p2;
435 ; CHECK-NEXT: bfi.b32 %r19, %r18, %r16, 16, 8;
436 ; CHECK-NEXT: bfe.u32 %r20, %r3, 24, 8;
437 ; CHECK-NEXT: selp.b32 %r21, %r5, %r20, %p1;
438 ; CHECK-NEXT: bfi.b32 %r22, %r21, %r19, 24, 8;
439 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r22;
441 %cmp = icmp eq <4 x i8> %a, %b
442 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %c
446 define <4 x i8> @test_ne(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c) #0 {
447 ; CHECK-LABEL: test_ne(
449 ; CHECK-NEXT: .reg .pred %p<5>;
450 ; CHECK-NEXT: .reg .b32 %r<24>;
452 ; CHECK-NEXT: // %bb.0:
453 ; CHECK-NEXT: ld.param.u32 %r3, [test_ne_param_2];
454 ; CHECK-NEXT: ld.param.u32 %r2, [test_ne_param_1];
455 ; CHECK-NEXT: ld.param.u32 %r1, [test_ne_param_0];
456 ; CHECK-NEXT: bfe.u32 %r4, %r2, 24, 8;
457 ; CHECK-NEXT: bfe.u32 %r5, %r1, 24, 8;
458 ; CHECK-NEXT: setp.ne.u32 %p1, %r5, %r4;
459 ; CHECK-NEXT: bfe.u32 %r6, %r2, 16, 8;
460 ; CHECK-NEXT: bfe.u32 %r7, %r1, 16, 8;
461 ; CHECK-NEXT: setp.ne.u32 %p2, %r7, %r6;
462 ; CHECK-NEXT: bfe.u32 %r8, %r2, 8, 8;
463 ; CHECK-NEXT: bfe.u32 %r9, %r1, 8, 8;
464 ; CHECK-NEXT: setp.ne.u32 %p3, %r9, %r8;
465 ; CHECK-NEXT: bfe.u32 %r10, %r2, 0, 8;
466 ; CHECK-NEXT: bfe.u32 %r11, %r1, 0, 8;
467 ; CHECK-NEXT: setp.ne.u32 %p4, %r11, %r10;
468 ; CHECK-NEXT: bfe.u32 %r12, %r3, 0, 8;
469 ; CHECK-NEXT: selp.b32 %r13, %r11, %r12, %p4;
470 ; CHECK-NEXT: bfe.u32 %r14, %r3, 8, 8;
471 ; CHECK-NEXT: selp.b32 %r15, %r9, %r14, %p3;
472 ; CHECK-NEXT: bfi.b32 %r16, %r15, %r13, 8, 8;
473 ; CHECK-NEXT: bfe.u32 %r17, %r3, 16, 8;
474 ; CHECK-NEXT: selp.b32 %r18, %r7, %r17, %p2;
475 ; CHECK-NEXT: bfi.b32 %r19, %r18, %r16, 16, 8;
476 ; CHECK-NEXT: bfe.u32 %r20, %r3, 24, 8;
477 ; CHECK-NEXT: selp.b32 %r21, %r5, %r20, %p1;
478 ; CHECK-NEXT: bfi.b32 %r22, %r21, %r19, 24, 8;
479 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r22;
481 %cmp = icmp ne <4 x i8> %a, %b
482 %r = select <4 x i1> %cmp, <4 x i8> %a, <4 x i8> %c
486 define <4 x i8> @test_mul(<4 x i8> %a, <4 x i8> %b) #0 {
487 ; CHECK-LABEL: test_mul(
489 ; CHECK-NEXT: .reg .b16 %rs<13>;
490 ; CHECK-NEXT: .reg .b32 %r<19>;
492 ; CHECK-NEXT: // %bb.0:
493 ; CHECK-NEXT: ld.param.u32 %r2, [test_mul_param_1];
494 ; CHECK-NEXT: ld.param.u32 %r1, [test_mul_param_0];
495 ; CHECK-NEXT: bfe.u32 %r3, %r2, 0, 8;
496 ; CHECK-NEXT: cvt.u16.u32 %rs1, %r3;
497 ; CHECK-NEXT: bfe.u32 %r4, %r1, 0, 8;
498 ; CHECK-NEXT: cvt.u16.u32 %rs2, %r4;
499 ; CHECK-NEXT: mul.lo.s16 %rs3, %rs2, %rs1;
500 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs3;
501 ; CHECK-NEXT: bfe.u32 %r6, %r2, 8, 8;
502 ; CHECK-NEXT: cvt.u16.u32 %rs4, %r6;
503 ; CHECK-NEXT: bfe.u32 %r7, %r1, 8, 8;
504 ; CHECK-NEXT: cvt.u16.u32 %rs5, %r7;
505 ; CHECK-NEXT: mul.lo.s16 %rs6, %rs5, %rs4;
506 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
507 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r5, 8, 8;
508 ; CHECK-NEXT: bfe.u32 %r10, %r2, 16, 8;
509 ; CHECK-NEXT: cvt.u16.u32 %rs7, %r10;
510 ; CHECK-NEXT: bfe.u32 %r11, %r1, 16, 8;
511 ; CHECK-NEXT: cvt.u16.u32 %rs8, %r11;
512 ; CHECK-NEXT: mul.lo.s16 %rs9, %rs8, %rs7;
513 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs9;
514 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r9, 16, 8;
515 ; CHECK-NEXT: bfe.u32 %r14, %r2, 24, 8;
516 ; CHECK-NEXT: cvt.u16.u32 %rs10, %r14;
517 ; CHECK-NEXT: bfe.u32 %r15, %r1, 24, 8;
518 ; CHECK-NEXT: cvt.u16.u32 %rs11, %r15;
519 ; CHECK-NEXT: mul.lo.s16 %rs12, %rs11, %rs10;
520 ; CHECK-NEXT: cvt.u32.u16 %r16, %rs12;
521 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r13, 24, 8;
522 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r17;
524 %r = mul <4 x i8> %a, %b
528 define <4 x i8> @test_or(<4 x i8> %a, <4 x i8> %b) #0 {
529 ; CHECK-LABEL: test_or(
531 ; CHECK-NEXT: .reg .b32 %r<7>;
533 ; CHECK-NEXT: // %bb.0:
534 ; CHECK-NEXT: ld.param.u32 %r3, [test_or_param_1];
535 ; CHECK-NEXT: ld.param.u32 %r4, [test_or_param_0];
536 ; CHECK-NEXT: or.b32 %r5, %r4, %r3;
537 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r5;
539 %r = or <4 x i8> %a, %b
543 define <4 x i8> @test_or_computed(i8 %a) {
544 ; CHECK-LABEL: test_or_computed(
546 ; CHECK-NEXT: .reg .b16 %rs<2>;
547 ; CHECK-NEXT: .reg .b32 %r<9>;
549 ; CHECK-NEXT: // %bb.0:
550 ; CHECK-NEXT: ld.param.u8 %rs1, [test_or_computed_param_0];
551 ; CHECK-NEXT: cvt.u32.u16 %r1, %rs1;
552 ; CHECK-NEXT: bfi.b32 %r2, 0, %r1, 8, 8;
553 ; CHECK-NEXT: bfi.b32 %r3, 0, %r2, 16, 8;
554 ; CHECK-NEXT: bfi.b32 %r4, 0, %r3, 24, 8;
555 ; CHECK-NEXT: bfi.b32 %r6, 5, %r4, 8, 8;
556 ; CHECK-NEXT: or.b32 %r8, %r6, %r4;
557 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r8;
559 %ins.0 = insertelement <4 x i8> zeroinitializer, i8 %a, i32 0
560 %ins.1 = insertelement <4 x i8> %ins.0, i8 5, i32 1
561 %r = or <4 x i8> %ins.1, %ins.0
565 define <4 x i8> @test_or_imm_0(<4 x i8> %a) #0 {
566 ; CHECK-LABEL: test_or_imm_0(
568 ; CHECK-NEXT: .reg .b32 %r<3>;
570 ; CHECK-NEXT: // %bb.0:
571 ; CHECK-NEXT: ld.param.u32 %r1, [test_or_imm_0_param_0];
572 ; CHECK-NEXT: or.b32 %r2, %r1, 67305985;
573 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
575 %r = or <4 x i8> <i8 1, i8 2, i8 3, i8 4>, %a
579 define <4 x i8> @test_or_imm_1(<4 x i8> %a) #0 {
580 ; CHECK-LABEL: test_or_imm_1(
582 ; CHECK-NEXT: .reg .b32 %r<3>;
584 ; CHECK-NEXT: // %bb.0:
585 ; CHECK-NEXT: ld.param.u32 %r1, [test_or_imm_1_param_0];
586 ; CHECK-NEXT: or.b32 %r2, %r1, 67305985;
587 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
589 %r = or <4 x i8> %a, <i8 1, i8 2, i8 3, i8 4>
593 define <4 x i8> @test_xor(<4 x i8> %a, <4 x i8> %b) #0 {
594 ; CHECK-LABEL: test_xor(
596 ; CHECK-NEXT: .reg .b32 %r<7>;
598 ; CHECK-NEXT: // %bb.0:
599 ; CHECK-NEXT: ld.param.u32 %r3, [test_xor_param_1];
600 ; CHECK-NEXT: ld.param.u32 %r4, [test_xor_param_0];
601 ; CHECK-NEXT: xor.b32 %r5, %r4, %r3;
602 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r5;
604 %r = xor <4 x i8> %a, %b
608 define <4 x i8> @test_xor_computed(i8 %a) {
609 ; CHECK-LABEL: test_xor_computed(
611 ; CHECK-NEXT: .reg .b16 %rs<2>;
612 ; CHECK-NEXT: .reg .b32 %r<9>;
614 ; CHECK-NEXT: // %bb.0:
615 ; CHECK-NEXT: ld.param.u8 %rs1, [test_xor_computed_param_0];
616 ; CHECK-NEXT: cvt.u32.u16 %r1, %rs1;
617 ; CHECK-NEXT: bfi.b32 %r2, 0, %r1, 8, 8;
618 ; CHECK-NEXT: bfi.b32 %r3, 0, %r2, 16, 8;
619 ; CHECK-NEXT: bfi.b32 %r4, 0, %r3, 24, 8;
620 ; CHECK-NEXT: bfi.b32 %r6, 5, %r4, 8, 8;
621 ; CHECK-NEXT: xor.b32 %r8, %r6, %r4;
622 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r8;
624 %ins.0 = insertelement <4 x i8> zeroinitializer, i8 %a, i32 0
625 %ins.1 = insertelement <4 x i8> %ins.0, i8 5, i32 1
626 %r = xor <4 x i8> %ins.1, %ins.0
630 define <4 x i8> @test_xor_imm_0(<4 x i8> %a) #0 {
631 ; CHECK-LABEL: test_xor_imm_0(
633 ; CHECK-NEXT: .reg .b32 %r<3>;
635 ; CHECK-NEXT: // %bb.0:
636 ; CHECK-NEXT: ld.param.u32 %r1, [test_xor_imm_0_param_0];
637 ; CHECK-NEXT: xor.b32 %r2, %r1, 67305985;
638 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
640 %r = xor <4 x i8> <i8 1, i8 2, i8 3, i8 4>, %a
644 define <4 x i8> @test_xor_imm_1(<4 x i8> %a) #0 {
645 ; CHECK-LABEL: test_xor_imm_1(
647 ; CHECK-NEXT: .reg .b32 %r<3>;
649 ; CHECK-NEXT: // %bb.0:
650 ; CHECK-NEXT: ld.param.u32 %r1, [test_xor_imm_1_param_0];
651 ; CHECK-NEXT: xor.b32 %r2, %r1, 67305985;
652 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
654 %r = xor <4 x i8> %a, <i8 1, i8 2, i8 3, i8 4>
658 define <4 x i8> @test_and(<4 x i8> %a, <4 x i8> %b) #0 {
659 ; CHECK-LABEL: test_and(
661 ; CHECK-NEXT: .reg .b32 %r<7>;
663 ; CHECK-NEXT: // %bb.0:
664 ; CHECK-NEXT: ld.param.u32 %r3, [test_and_param_1];
665 ; CHECK-NEXT: ld.param.u32 %r4, [test_and_param_0];
666 ; CHECK-NEXT: and.b32 %r5, %r4, %r3;
667 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r5;
669 %r = and <4 x i8> %a, %b
673 define <4 x i8> @test_and_computed(i8 %a) {
674 ; CHECK-LABEL: test_and_computed(
676 ; CHECK-NEXT: .reg .b16 %rs<2>;
677 ; CHECK-NEXT: .reg .b32 %r<9>;
679 ; CHECK-NEXT: // %bb.0:
680 ; CHECK-NEXT: ld.param.u8 %rs1, [test_and_computed_param_0];
681 ; CHECK-NEXT: cvt.u32.u16 %r1, %rs1;
682 ; CHECK-NEXT: bfi.b32 %r2, 0, %r1, 8, 8;
683 ; CHECK-NEXT: bfi.b32 %r3, 0, %r2, 16, 8;
684 ; CHECK-NEXT: bfi.b32 %r4, 0, %r3, 24, 8;
685 ; CHECK-NEXT: bfi.b32 %r6, 5, %r4, 8, 8;
686 ; CHECK-NEXT: and.b32 %r8, %r6, %r4;
687 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r8;
689 %ins.0 = insertelement <4 x i8> zeroinitializer, i8 %a, i32 0
690 %ins.1 = insertelement <4 x i8> %ins.0, i8 5, i32 1
691 %r = and <4 x i8> %ins.1, %ins.0
695 define <4 x i8> @test_and_imm_0(<4 x i8> %a) #0 {
696 ; CHECK-LABEL: test_and_imm_0(
698 ; CHECK-NEXT: .reg .b32 %r<3>;
700 ; CHECK-NEXT: // %bb.0:
701 ; CHECK-NEXT: ld.param.u32 %r1, [test_and_imm_0_param_0];
702 ; CHECK-NEXT: and.b32 %r2, %r1, 67305985;
703 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
705 %r = and <4 x i8> <i8 1, i8 2, i8 3, i8 4>, %a
709 define <4 x i8> @test_and_imm_1(<4 x i8> %a) #0 {
710 ; CHECK-LABEL: test_and_imm_1(
712 ; CHECK-NEXT: .reg .b32 %r<3>;
714 ; CHECK-NEXT: // %bb.0:
715 ; CHECK-NEXT: ld.param.u32 %r1, [test_and_imm_1_param_0];
716 ; CHECK-NEXT: and.b32 %r2, %r1, 67305985;
717 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
719 %r = and <4 x i8> %a, <i8 1, i8 2, i8 3, i8 4>
723 define void @test_ldst_v2i8(ptr %a, ptr %b) {
724 ; CHECK-LABEL: test_ldst_v2i8(
726 ; CHECK-NEXT: .reg .b32 %r<2>;
727 ; CHECK-NEXT: .reg .b64 %rd<3>;
729 ; CHECK-NEXT: // %bb.0:
730 ; CHECK-NEXT: ld.param.u64 %rd2, [test_ldst_v2i8_param_1];
731 ; CHECK-NEXT: ld.param.u64 %rd1, [test_ldst_v2i8_param_0];
732 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
733 ; CHECK-NEXT: st.u32 [%rd2], %r1;
735 %t1 = load <4 x i8>, ptr %a
736 store <4 x i8> %t1, ptr %b, align 16
740 define void @test_ldst_v3i8(ptr %a, ptr %b) {
741 ; CHECK-LABEL: test_ldst_v3i8(
743 ; CHECK-NEXT: .reg .b32 %r<4>;
744 ; CHECK-NEXT: .reg .b64 %rd<3>;
746 ; CHECK-NEXT: // %bb.0:
747 ; CHECK-NEXT: ld.param.u64 %rd2, [test_ldst_v3i8_param_1];
748 ; CHECK-NEXT: ld.param.u64 %rd1, [test_ldst_v3i8_param_0];
749 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
750 ; CHECK-NEXT: st.u16 [%rd2], %r1;
751 ; CHECK-NEXT: bfe.u32 %r3, %r1, 16, 8;
752 ; CHECK-NEXT: st.u8 [%rd2+2], %r3;
754 %t1 = load <3 x i8>, ptr %a
755 store <3 x i8> %t1, ptr %b, align 16
759 define void @test_ldst_v4i8(ptr %a, ptr %b) {
760 ; CHECK-LABEL: test_ldst_v4i8(
762 ; CHECK-NEXT: .reg .b32 %r<2>;
763 ; CHECK-NEXT: .reg .b64 %rd<3>;
765 ; CHECK-NEXT: // %bb.0:
766 ; CHECK-NEXT: ld.param.u64 %rd2, [test_ldst_v4i8_param_1];
767 ; CHECK-NEXT: ld.param.u64 %rd1, [test_ldst_v4i8_param_0];
768 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
769 ; CHECK-NEXT: st.u32 [%rd2], %r1;
771 %t1 = load <4 x i8>, ptr %a
772 store <4 x i8> %t1, ptr %b, align 16
776 define void @test_ldst_v4i8_unaligned(ptr %a, ptr %b) {
777 ; CHECK-LABEL: test_ldst_v4i8_unaligned(
779 ; CHECK-NEXT: .reg .b32 %r<5>;
780 ; CHECK-NEXT: .reg .b64 %rd<3>;
782 ; CHECK-NEXT: // %bb.0:
783 ; CHECK-NEXT: ld.param.u64 %rd2, [test_ldst_v4i8_unaligned_param_1];
784 ; CHECK-NEXT: ld.param.u64 %rd1, [test_ldst_v4i8_unaligned_param_0];
785 ; CHECK-NEXT: ld.u8 %r1, [%rd1];
786 ; CHECK-NEXT: ld.u8 %r2, [%rd1+1];
787 ; CHECK-NEXT: ld.u8 %r3, [%rd1+2];
788 ; CHECK-NEXT: ld.u8 %r4, [%rd1+3];
789 ; CHECK-NEXT: st.u8 [%rd2+3], %r4;
790 ; CHECK-NEXT: st.u8 [%rd2+2], %r3;
791 ; CHECK-NEXT: st.u8 [%rd2+1], %r2;
792 ; CHECK-NEXT: st.u8 [%rd2], %r1;
794 %t1 = load <4 x i8>, ptr %a, align 1
795 store <4 x i8> %t1, ptr %b, align 1
800 define void @test_ldst_v8i8(ptr %a, ptr %b) {
801 ; CHECK-LABEL: test_ldst_v8i8(
803 ; CHECK-NEXT: .reg .b32 %r<3>;
804 ; CHECK-NEXT: .reg .b64 %rd<3>;
806 ; CHECK-NEXT: // %bb.0:
807 ; CHECK-NEXT: ld.param.u64 %rd2, [test_ldst_v8i8_param_1];
808 ; CHECK-NEXT: ld.param.u64 %rd1, [test_ldst_v8i8_param_0];
809 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
810 ; CHECK-NEXT: ld.u32 %r2, [%rd1+4];
811 ; CHECK-NEXT: st.u32 [%rd2+4], %r2;
812 ; CHECK-NEXT: st.u32 [%rd2], %r1;
814 %t1 = load <8 x i8>, ptr %a
815 store <8 x i8> %t1, ptr %b, align 16
819 declare <4 x i8> @test_callee(<4 x i8> %a, <4 x i8> %b) #0
821 define <4 x i8> @test_call(<4 x i8> %a, <4 x i8> %b) #0 {
822 ; CHECK-LABEL: test_call(
824 ; CHECK-NEXT: .reg .b32 %r<5>;
826 ; CHECK-NEXT: // %bb.0:
827 ; CHECK-NEXT: ld.param.u32 %r2, [test_call_param_1];
828 ; CHECK-NEXT: ld.param.u32 %r1, [test_call_param_0];
829 ; CHECK-NEXT: { // callseq 0, 0
830 ; CHECK-NEXT: .param .align 4 .b8 param0[4];
831 ; CHECK-NEXT: st.param.b32 [param0+0], %r1;
832 ; CHECK-NEXT: .param .align 4 .b8 param1[4];
833 ; CHECK-NEXT: st.param.b32 [param1+0], %r2;
834 ; CHECK-NEXT: .param .align 4 .b8 retval0[4];
835 ; CHECK-NEXT: call.uni (retval0),
836 ; CHECK-NEXT: test_callee,
838 ; CHECK-NEXT: param0,
841 ; CHECK-NEXT: ld.param.b32 %r3, [retval0+0];
842 ; CHECK-NEXT: } // callseq 0
843 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
845 %r = call <4 x i8> @test_callee(<4 x i8> %a, <4 x i8> %b)
849 define <4 x i8> @test_call_flipped(<4 x i8> %a, <4 x i8> %b) #0 {
850 ; CHECK-LABEL: test_call_flipped(
852 ; CHECK-NEXT: .reg .b32 %r<5>;
854 ; CHECK-NEXT: // %bb.0:
855 ; CHECK-NEXT: ld.param.u32 %r2, [test_call_flipped_param_1];
856 ; CHECK-NEXT: ld.param.u32 %r1, [test_call_flipped_param_0];
857 ; CHECK-NEXT: { // callseq 1, 0
858 ; CHECK-NEXT: .param .align 4 .b8 param0[4];
859 ; CHECK-NEXT: st.param.b32 [param0+0], %r2;
860 ; CHECK-NEXT: .param .align 4 .b8 param1[4];
861 ; CHECK-NEXT: st.param.b32 [param1+0], %r1;
862 ; CHECK-NEXT: .param .align 4 .b8 retval0[4];
863 ; CHECK-NEXT: call.uni (retval0),
864 ; CHECK-NEXT: test_callee,
866 ; CHECK-NEXT: param0,
869 ; CHECK-NEXT: ld.param.b32 %r3, [retval0+0];
870 ; CHECK-NEXT: } // callseq 1
871 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
873 %r = call <4 x i8> @test_callee(<4 x i8> %b, <4 x i8> %a)
877 define <4 x i8> @test_tailcall_flipped(<4 x i8> %a, <4 x i8> %b) #0 {
878 ; CHECK-LABEL: test_tailcall_flipped(
880 ; CHECK-NEXT: .reg .b32 %r<5>;
882 ; CHECK-NEXT: // %bb.0:
883 ; CHECK-NEXT: ld.param.u32 %r2, [test_tailcall_flipped_param_1];
884 ; CHECK-NEXT: ld.param.u32 %r1, [test_tailcall_flipped_param_0];
885 ; CHECK-NEXT: { // callseq 2, 0
886 ; CHECK-NEXT: .param .align 4 .b8 param0[4];
887 ; CHECK-NEXT: st.param.b32 [param0+0], %r2;
888 ; CHECK-NEXT: .param .align 4 .b8 param1[4];
889 ; CHECK-NEXT: st.param.b32 [param1+0], %r1;
890 ; CHECK-NEXT: .param .align 4 .b8 retval0[4];
891 ; CHECK-NEXT: call.uni (retval0),
892 ; CHECK-NEXT: test_callee,
894 ; CHECK-NEXT: param0,
897 ; CHECK-NEXT: ld.param.b32 %r3, [retval0+0];
898 ; CHECK-NEXT: } // callseq 2
899 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
901 %r = tail call <4 x i8> @test_callee(<4 x i8> %b, <4 x i8> %a)
905 define <4 x i8> @test_select(<4 x i8> %a, <4 x i8> %b, i1 zeroext %c) #0 {
906 ; CHECK-LABEL: test_select(
908 ; CHECK-NEXT: .reg .pred %p<2>;
909 ; CHECK-NEXT: .reg .b16 %rs<3>;
910 ; CHECK-NEXT: .reg .b32 %r<4>;
912 ; CHECK-NEXT: // %bb.0:
913 ; CHECK-NEXT: ld.param.u8 %rs1, [test_select_param_2];
914 ; CHECK-NEXT: and.b16 %rs2, %rs1, 1;
915 ; CHECK-NEXT: setp.eq.b16 %p1, %rs2, 1;
916 ; CHECK-NEXT: ld.param.u32 %r2, [test_select_param_1];
917 ; CHECK-NEXT: ld.param.u32 %r1, [test_select_param_0];
918 ; CHECK-NEXT: selp.b32 %r3, %r1, %r2, %p1;
919 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
921 %r = select i1 %c, <4 x i8> %a, <4 x i8> %b
925 define <4 x i8> @test_select_cc(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c, <4 x i8> %d) #0 {
926 ; CHECK-LABEL: test_select_cc(
928 ; CHECK-NEXT: .reg .pred %p<5>;
929 ; CHECK-NEXT: .reg .b32 %r<29>;
931 ; CHECK-NEXT: // %bb.0:
932 ; CHECK-NEXT: ld.param.u32 %r4, [test_select_cc_param_3];
933 ; CHECK-NEXT: ld.param.u32 %r3, [test_select_cc_param_2];
934 ; CHECK-NEXT: ld.param.u32 %r2, [test_select_cc_param_1];
935 ; CHECK-NEXT: ld.param.u32 %r1, [test_select_cc_param_0];
936 ; CHECK-NEXT: bfe.u32 %r5, %r4, 24, 8;
937 ; CHECK-NEXT: bfe.u32 %r6, %r3, 24, 8;
938 ; CHECK-NEXT: setp.ne.u32 %p1, %r6, %r5;
939 ; CHECK-NEXT: bfe.u32 %r7, %r4, 16, 8;
940 ; CHECK-NEXT: bfe.u32 %r8, %r3, 16, 8;
941 ; CHECK-NEXT: setp.ne.u32 %p2, %r8, %r7;
942 ; CHECK-NEXT: bfe.u32 %r9, %r4, 8, 8;
943 ; CHECK-NEXT: bfe.u32 %r10, %r3, 8, 8;
944 ; CHECK-NEXT: setp.ne.u32 %p3, %r10, %r9;
945 ; CHECK-NEXT: bfe.u32 %r11, %r4, 0, 8;
946 ; CHECK-NEXT: bfe.u32 %r12, %r3, 0, 8;
947 ; CHECK-NEXT: setp.ne.u32 %p4, %r12, %r11;
948 ; CHECK-NEXT: bfe.u32 %r13, %r2, 0, 8;
949 ; CHECK-NEXT: bfe.u32 %r14, %r1, 0, 8;
950 ; CHECK-NEXT: selp.b32 %r15, %r14, %r13, %p4;
951 ; CHECK-NEXT: bfe.u32 %r16, %r2, 8, 8;
952 ; CHECK-NEXT: bfe.u32 %r17, %r1, 8, 8;
953 ; CHECK-NEXT: selp.b32 %r18, %r17, %r16, %p3;
954 ; CHECK-NEXT: bfi.b32 %r19, %r18, %r15, 8, 8;
955 ; CHECK-NEXT: bfe.u32 %r20, %r2, 16, 8;
956 ; CHECK-NEXT: bfe.u32 %r21, %r1, 16, 8;
957 ; CHECK-NEXT: selp.b32 %r22, %r21, %r20, %p2;
958 ; CHECK-NEXT: bfi.b32 %r23, %r22, %r19, 16, 8;
959 ; CHECK-NEXT: bfe.u32 %r24, %r2, 24, 8;
960 ; CHECK-NEXT: bfe.u32 %r25, %r1, 24, 8;
961 ; CHECK-NEXT: selp.b32 %r26, %r25, %r24, %p1;
962 ; CHECK-NEXT: bfi.b32 %r27, %r26, %r23, 24, 8;
963 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r27;
965 %cc = icmp ne <4 x i8> %c, %d
966 %r = select <4 x i1> %cc, <4 x i8> %a, <4 x i8> %b
970 define <4 x i32> @test_select_cc_i32_i8(<4 x i32> %a, <4 x i32> %b,
971 ; CHECK-LABEL: test_select_cc_i32_i8(
973 ; CHECK-NEXT: .reg .pred %p<5>;
974 ; CHECK-NEXT: .reg .b32 %r<23>;
976 ; CHECK-NEXT: // %bb.0:
977 ; CHECK-NEXT: ld.param.v4.u32 {%r5, %r6, %r7, %r8}, [test_select_cc_i32_i8_param_1];
978 ; CHECK-NEXT: ld.param.v4.u32 {%r1, %r2, %r3, %r4}, [test_select_cc_i32_i8_param_0];
979 ; CHECK-NEXT: ld.param.u32 %r10, [test_select_cc_i32_i8_param_3];
980 ; CHECK-NEXT: ld.param.u32 %r9, [test_select_cc_i32_i8_param_2];
981 ; CHECK-NEXT: bfe.u32 %r11, %r10, 0, 8;
982 ; CHECK-NEXT: bfe.u32 %r12, %r9, 0, 8;
983 ; CHECK-NEXT: setp.ne.u32 %p1, %r12, %r11;
984 ; CHECK-NEXT: bfe.u32 %r13, %r10, 8, 8;
985 ; CHECK-NEXT: bfe.u32 %r14, %r9, 8, 8;
986 ; CHECK-NEXT: setp.ne.u32 %p2, %r14, %r13;
987 ; CHECK-NEXT: bfe.u32 %r15, %r10, 16, 8;
988 ; CHECK-NEXT: bfe.u32 %r16, %r9, 16, 8;
989 ; CHECK-NEXT: setp.ne.u32 %p3, %r16, %r15;
990 ; CHECK-NEXT: bfe.u32 %r17, %r10, 24, 8;
991 ; CHECK-NEXT: bfe.u32 %r18, %r9, 24, 8;
992 ; CHECK-NEXT: setp.ne.u32 %p4, %r18, %r17;
993 ; CHECK-NEXT: selp.b32 %r19, %r4, %r8, %p4;
994 ; CHECK-NEXT: selp.b32 %r20, %r3, %r7, %p3;
995 ; CHECK-NEXT: selp.b32 %r21, %r2, %r6, %p2;
996 ; CHECK-NEXT: selp.b32 %r22, %r1, %r5, %p1;
997 ; CHECK-NEXT: st.param.v4.b32 [func_retval0+0], {%r22, %r21, %r20, %r19};
999 <4 x i8> %c, <4 x i8> %d) #0 {
1000 %cc = icmp ne <4 x i8> %c, %d
1001 %r = select <4 x i1> %cc, <4 x i32> %a, <4 x i32> %b
1005 define <4 x i8> @test_select_cc_i8_i32(<4 x i8> %a, <4 x i8> %b,
1006 ; CHECK-LABEL: test_select_cc_i8_i32(
1008 ; CHECK-NEXT: .reg .pred %p<5>;
1009 ; CHECK-NEXT: .reg .b32 %r<27>;
1011 ; CHECK-NEXT: // %bb.0:
1012 ; CHECK-NEXT: ld.param.v4.u32 {%r7, %r8, %r9, %r10}, [test_select_cc_i8_i32_param_3];
1013 ; CHECK-NEXT: ld.param.v4.u32 {%r3, %r4, %r5, %r6}, [test_select_cc_i8_i32_param_2];
1014 ; CHECK-NEXT: ld.param.u32 %r2, [test_select_cc_i8_i32_param_1];
1015 ; CHECK-NEXT: ld.param.u32 %r1, [test_select_cc_i8_i32_param_0];
1016 ; CHECK-NEXT: setp.ne.s32 %p1, %r6, %r10;
1017 ; CHECK-NEXT: setp.ne.s32 %p2, %r5, %r9;
1018 ; CHECK-NEXT: setp.ne.s32 %p3, %r4, %r8;
1019 ; CHECK-NEXT: setp.ne.s32 %p4, %r3, %r7;
1020 ; CHECK-NEXT: bfe.u32 %r11, %r2, 0, 8;
1021 ; CHECK-NEXT: bfe.u32 %r12, %r1, 0, 8;
1022 ; CHECK-NEXT: selp.b32 %r13, %r12, %r11, %p4;
1023 ; CHECK-NEXT: bfe.u32 %r14, %r2, 8, 8;
1024 ; CHECK-NEXT: bfe.u32 %r15, %r1, 8, 8;
1025 ; CHECK-NEXT: selp.b32 %r16, %r15, %r14, %p3;
1026 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r13, 8, 8;
1027 ; CHECK-NEXT: bfe.u32 %r18, %r2, 16, 8;
1028 ; CHECK-NEXT: bfe.u32 %r19, %r1, 16, 8;
1029 ; CHECK-NEXT: selp.b32 %r20, %r19, %r18, %p2;
1030 ; CHECK-NEXT: bfi.b32 %r21, %r20, %r17, 16, 8;
1031 ; CHECK-NEXT: bfe.u32 %r22, %r2, 24, 8;
1032 ; CHECK-NEXT: bfe.u32 %r23, %r1, 24, 8;
1033 ; CHECK-NEXT: selp.b32 %r24, %r23, %r22, %p1;
1034 ; CHECK-NEXT: bfi.b32 %r25, %r24, %r21, 24, 8;
1035 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r25;
1037 <4 x i32> %c, <4 x i32> %d) #0 {
1038 %cc = icmp ne <4 x i32> %c, %d
1039 %r = select <4 x i1> %cc, <4 x i8> %a, <4 x i8> %b
1044 define <4 x i8> @test_trunc_2xi32(<4 x i32> %a) #0 {
1045 ; CHECK-LABEL: test_trunc_2xi32(
1047 ; CHECK-NEXT: .reg .b32 %r<9>;
1049 ; CHECK-NEXT: // %bb.0:
1050 ; CHECK-NEXT: ld.param.v4.u32 {%r1, %r2, %r3, %r4}, [test_trunc_2xi32_param_0];
1051 ; CHECK-NEXT: bfi.b32 %r5, %r2, %r1, 8, 8;
1052 ; CHECK-NEXT: bfi.b32 %r6, %r3, %r5, 16, 8;
1053 ; CHECK-NEXT: bfi.b32 %r7, %r4, %r6, 24, 8;
1054 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r7;
1056 %r = trunc <4 x i32> %a to <4 x i8>
1060 define <4 x i8> @test_trunc_2xi64(<4 x i64> %a) #0 {
1061 ; CHECK-LABEL: test_trunc_2xi64(
1063 ; CHECK-NEXT: .reg .b32 %r<9>;
1064 ; CHECK-NEXT: .reg .b64 %rd<5>;
1066 ; CHECK-NEXT: // %bb.0:
1067 ; CHECK-NEXT: ld.param.v2.u64 {%rd3, %rd4}, [test_trunc_2xi64_param_0+16];
1068 ; CHECK-NEXT: ld.param.v2.u64 {%rd1, %rd2}, [test_trunc_2xi64_param_0];
1069 ; CHECK-NEXT: cvt.u32.u64 %r1, %rd1;
1070 ; CHECK-NEXT: cvt.u32.u64 %r2, %rd2;
1071 ; CHECK-NEXT: bfi.b32 %r3, %r2, %r1, 8, 8;
1072 ; CHECK-NEXT: cvt.u32.u64 %r4, %rd3;
1073 ; CHECK-NEXT: bfi.b32 %r5, %r4, %r3, 16, 8;
1074 ; CHECK-NEXT: cvt.u32.u64 %r6, %rd4;
1075 ; CHECK-NEXT: bfi.b32 %r7, %r6, %r5, 24, 8;
1076 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r7;
1078 %r = trunc <4 x i64> %a to <4 x i8>
1082 define <4 x i32> @test_zext_2xi32(<4 x i8> %a) #0 {
1083 ; CHECK-LABEL: test_zext_2xi32(
1085 ; CHECK-NEXT: .reg .b32 %r<6>;
1087 ; CHECK-NEXT: // %bb.0:
1088 ; CHECK-NEXT: ld.param.u32 %r1, [test_zext_2xi32_param_0];
1089 ; CHECK-NEXT: bfe.u32 %r2, %r1, 24, 8;
1090 ; CHECK-NEXT: bfe.u32 %r3, %r1, 16, 8;
1091 ; CHECK-NEXT: bfe.u32 %r4, %r1, 8, 8;
1092 ; CHECK-NEXT: bfe.u32 %r5, %r1, 0, 8;
1093 ; CHECK-NEXT: st.param.v4.b32 [func_retval0+0], {%r5, %r4, %r3, %r2};
1095 %r = zext <4 x i8> %a to <4 x i32>
1099 define <4 x i64> @test_zext_2xi64(<4 x i8> %a) #0 {
1100 ; CHECK-LABEL: test_zext_2xi64(
1102 ; CHECK-NEXT: .reg .b32 %r<6>;
1103 ; CHECK-NEXT: .reg .b64 %rd<9>;
1105 ; CHECK-NEXT: // %bb.0:
1106 ; CHECK-NEXT: ld.param.u32 %r1, [test_zext_2xi64_param_0];
1107 ; CHECK-NEXT: bfe.u32 %r2, %r1, 24, 8;
1108 ; CHECK-NEXT: cvt.u64.u32 %rd1, %r2;
1109 ; CHECK-NEXT: and.b64 %rd2, %rd1, 255;
1110 ; CHECK-NEXT: bfe.u32 %r3, %r1, 16, 8;
1111 ; CHECK-NEXT: cvt.u64.u32 %rd3, %r3;
1112 ; CHECK-NEXT: and.b64 %rd4, %rd3, 255;
1113 ; CHECK-NEXT: bfe.u32 %r4, %r1, 8, 8;
1114 ; CHECK-NEXT: cvt.u64.u32 %rd5, %r4;
1115 ; CHECK-NEXT: and.b64 %rd6, %rd5, 255;
1116 ; CHECK-NEXT: bfe.u32 %r5, %r1, 0, 8;
1117 ; CHECK-NEXT: cvt.u64.u32 %rd7, %r5;
1118 ; CHECK-NEXT: and.b64 %rd8, %rd7, 255;
1119 ; CHECK-NEXT: st.param.v2.b64 [func_retval0+0], {%rd8, %rd6};
1120 ; CHECK-NEXT: st.param.v2.b64 [func_retval0+16], {%rd4, %rd2};
1122 %r = zext <4 x i8> %a to <4 x i64>
1126 define <4 x i8> @test_bitcast_i32_to_4xi8(i32 %a) #0 {
1127 ; CHECK-LABEL: test_bitcast_i32_to_4xi8(
1129 ; CHECK-NEXT: .reg .b32 %r<3>;
1131 ; CHECK-NEXT: // %bb.0:
1132 ; CHECK-NEXT: ld.param.u32 %r1, [test_bitcast_i32_to_4xi8_param_0];
1133 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r1;
1135 %r = bitcast i32 %a to <4 x i8>
1139 define <4 x i8> @test_bitcast_float_to_4xi8(float %a) #0 {
1140 ; CHECK-LABEL: test_bitcast_float_to_4xi8(
1142 ; CHECK-NEXT: .reg .b32 %r<2>;
1143 ; CHECK-NEXT: .reg .f32 %f<2>;
1145 ; CHECK-NEXT: // %bb.0:
1146 ; CHECK-NEXT: ld.param.f32 %f1, [test_bitcast_float_to_4xi8_param_0];
1147 ; CHECK-NEXT: mov.b32 %r1, %f1;
1148 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r1;
1150 %r = bitcast float %a to <4 x i8>
1154 define i32 @test_bitcast_4xi8_to_i32(<4 x i8> %a) #0 {
1155 ; CHECK-LABEL: test_bitcast_4xi8_to_i32(
1157 ; CHECK-NEXT: .reg .b32 %r<3>;
1159 ; CHECK-NEXT: // %bb.0:
1160 ; CHECK-NEXT: ld.param.u32 %r2, [test_bitcast_4xi8_to_i32_param_0];
1161 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
1163 %r = bitcast <4 x i8> %a to i32
1167 define float @test_bitcast_4xi8_to_float(<4 x i8> %a) #0 {
1168 ; CHECK-LABEL: test_bitcast_4xi8_to_float(
1170 ; CHECK-NEXT: .reg .b32 %r<3>;
1171 ; CHECK-NEXT: .reg .f32 %f<2>;
1173 ; CHECK-NEXT: // %bb.0:
1174 ; CHECK-NEXT: ld.param.u32 %r2, [test_bitcast_4xi8_to_float_param_0];
1175 ; CHECK-NEXT: mov.b32 %f1, %r2;
1176 ; CHECK-NEXT: st.param.f32 [func_retval0+0], %f1;
1178 %r = bitcast <4 x i8> %a to float
1183 define <2 x half> @test_bitcast_4xi8_to_2xhalf(i8 %a) #0 {
1184 ; CHECK-LABEL: test_bitcast_4xi8_to_2xhalf(
1186 ; CHECK-NEXT: .reg .b16 %rs<2>;
1187 ; CHECK-NEXT: .reg .b32 %r<6>;
1189 ; CHECK-NEXT: // %bb.0:
1190 ; CHECK-NEXT: ld.param.u8 %rs1, [test_bitcast_4xi8_to_2xhalf_param_0];
1191 ; CHECK-NEXT: cvt.u32.u16 %r1, %rs1;
1192 ; CHECK-NEXT: bfi.b32 %r2, 5, %r1, 8, 8;
1193 ; CHECK-NEXT: bfi.b32 %r3, 6, %r2, 16, 8;
1194 ; CHECK-NEXT: bfi.b32 %r4, 7, %r3, 24, 8;
1195 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r4;
1197 %ins.0 = insertelement <4 x i8> undef, i8 %a, i32 0
1198 %ins.1 = insertelement <4 x i8> %ins.0, i8 5, i32 1
1199 %ins.2 = insertelement <4 x i8> %ins.1, i8 6, i32 2
1200 %ins.3 = insertelement <4 x i8> %ins.2, i8 7, i32 3
1201 %r = bitcast <4 x i8> %ins.3 to <2 x half>
1206 define <4 x i8> @test_shufflevector(<4 x i8> %a) #0 {
1207 ; CHECK-LABEL: test_shufflevector(
1209 ; CHECK-NEXT: .reg .b32 %r<4>;
1211 ; CHECK-NEXT: // %bb.0:
1212 ; CHECK-NEXT: ld.param.u32 %r1, [test_shufflevector_param_0];
1213 ; CHECK-NEXT: // implicit-def: %r3
1214 ; CHECK-NEXT: prmt.b32 %r2, %r1, %r3, 291;
1215 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r2;
1217 %s = shufflevector <4 x i8> %a, <4 x i8> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
1221 define <4 x i8> @test_shufflevector_2(<4 x i8> %a, <4 x i8> %b) #0 {
1222 ; CHECK-LABEL: test_shufflevector_2(
1224 ; CHECK-NEXT: .reg .b32 %r<4>;
1226 ; CHECK-NEXT: // %bb.0:
1227 ; CHECK-NEXT: ld.param.u32 %r2, [test_shufflevector_2_param_1];
1228 ; CHECK-NEXT: ld.param.u32 %r1, [test_shufflevector_2_param_0];
1229 ; CHECK-NEXT: prmt.b32 %r3, %r1, %r2, 9527;
1230 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
1232 %s = shufflevector <4 x i8> %a, <4 x i8> %b, <4 x i32> <i32 7, i32 3, i32 5, i32 2>
1237 define <4 x i8> @test_insertelement(<4 x i8> %a, i8 %x) #0 {
1238 ; CHECK-LABEL: test_insertelement(
1240 ; CHECK-NEXT: .reg .b16 %rs<2>;
1241 ; CHECK-NEXT: .reg .b32 %r<5>;
1243 ; CHECK-NEXT: // %bb.0:
1244 ; CHECK-NEXT: ld.param.u8 %rs1, [test_insertelement_param_1];
1245 ; CHECK-NEXT: ld.param.u32 %r1, [test_insertelement_param_0];
1246 ; CHECK-NEXT: cvt.u32.u16 %r2, %rs1;
1247 ; CHECK-NEXT: bfi.b32 %r3, %r2, %r1, 8, 8;
1248 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r3;
1250 %i = insertelement <4 x i8> %a, i8 %x, i64 1
1254 define <4 x i8> @test_fptosi_4xhalf_to_4xi8(<4 x half> %a) #0 {
1255 ; CHECK-LABEL: test_fptosi_4xhalf_to_4xi8(
1257 ; CHECK-NEXT: .reg .b16 %rs<13>;
1258 ; CHECK-NEXT: .reg .b32 %r<15>;
1260 ; CHECK-NEXT: // %bb.0:
1261 ; CHECK-NEXT: ld.param.v2.u32 {%r3, %r4}, [test_fptosi_4xhalf_to_4xi8_param_0];
1262 ; CHECK-NEXT: mov.b32 {%rs1, %rs2}, %r3;
1263 ; CHECK-NEXT: cvt.rzi.s16.f16 %rs3, %rs2;
1264 ; CHECK-NEXT: cvt.rzi.s16.f16 %rs4, %rs1;
1265 ; CHECK-NEXT: mov.b32 %r5, {%rs4, %rs3};
1266 ; CHECK-NEXT: mov.b32 {%rs5, %rs6}, %r5;
1267 ; CHECK-NEXT: cvt.u32.u16 %r6, %rs5;
1268 ; CHECK-NEXT: cvt.u32.u16 %r7, %rs6;
1269 ; CHECK-NEXT: bfi.b32 %r8, %r7, %r6, 8, 8;
1270 ; CHECK-NEXT: mov.b32 {%rs7, %rs8}, %r4;
1271 ; CHECK-NEXT: cvt.rzi.s16.f16 %rs9, %rs8;
1272 ; CHECK-NEXT: cvt.rzi.s16.f16 %rs10, %rs7;
1273 ; CHECK-NEXT: mov.b32 %r9, {%rs10, %rs9};
1274 ; CHECK-NEXT: mov.b32 {%rs11, %rs12}, %r9;
1275 ; CHECK-NEXT: cvt.u32.u16 %r10, %rs11;
1276 ; CHECK-NEXT: bfi.b32 %r11, %r10, %r8, 16, 8;
1277 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs12;
1278 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r11, 24, 8;
1279 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r13;
1281 %r = fptosi <4 x half> %a to <4 x i8>
1285 define <4 x i8> @test_fptoui_4xhalf_to_4xi8(<4 x half> %a) #0 {
1286 ; CHECK-LABEL: test_fptoui_4xhalf_to_4xi8(
1288 ; CHECK-NEXT: .reg .b16 %rs<13>;
1289 ; CHECK-NEXT: .reg .b32 %r<15>;
1291 ; CHECK-NEXT: // %bb.0:
1292 ; CHECK-NEXT: ld.param.v2.u32 {%r3, %r4}, [test_fptoui_4xhalf_to_4xi8_param_0];
1293 ; CHECK-NEXT: mov.b32 {%rs1, %rs2}, %r3;
1294 ; CHECK-NEXT: cvt.rzi.u16.f16 %rs3, %rs2;
1295 ; CHECK-NEXT: cvt.rzi.u16.f16 %rs4, %rs1;
1296 ; CHECK-NEXT: mov.b32 %r5, {%rs4, %rs3};
1297 ; CHECK-NEXT: mov.b32 {%rs5, %rs6}, %r5;
1298 ; CHECK-NEXT: cvt.u32.u16 %r6, %rs5;
1299 ; CHECK-NEXT: cvt.u32.u16 %r7, %rs6;
1300 ; CHECK-NEXT: bfi.b32 %r8, %r7, %r6, 8, 8;
1301 ; CHECK-NEXT: mov.b32 {%rs7, %rs8}, %r4;
1302 ; CHECK-NEXT: cvt.rzi.u16.f16 %rs9, %rs8;
1303 ; CHECK-NEXT: cvt.rzi.u16.f16 %rs10, %rs7;
1304 ; CHECK-NEXT: mov.b32 %r9, {%rs10, %rs9};
1305 ; CHECK-NEXT: mov.b32 {%rs11, %rs12}, %r9;
1306 ; CHECK-NEXT: cvt.u32.u16 %r10, %rs11;
1307 ; CHECK-NEXT: bfi.b32 %r11, %r10, %r8, 16, 8;
1308 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs12;
1309 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r11, 24, 8;
1310 ; CHECK-NEXT: st.param.b32 [func_retval0+0], %r13;
1312 %r = fptoui <4 x half> %a to <4 x i8>
1316 define void @test_srem_v4i8(ptr %a, ptr %b, ptr %c) {
1317 ; CHECK-LABEL: test_srem_v4i8(
1319 ; CHECK-NEXT: .reg .b16 %rs<13>;
1320 ; CHECK-NEXT: .reg .b32 %r<18>;
1321 ; CHECK-NEXT: .reg .b64 %rd<4>;
1323 ; CHECK-NEXT: // %bb.0: // %entry
1324 ; CHECK-NEXT: ld.param.u64 %rd3, [test_srem_v4i8_param_2];
1325 ; CHECK-NEXT: ld.param.u64 %rd2, [test_srem_v4i8_param_1];
1326 ; CHECK-NEXT: ld.param.u64 %rd1, [test_srem_v4i8_param_0];
1327 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
1328 ; CHECK-NEXT: ld.u32 %r2, [%rd2];
1329 ; CHECK-NEXT: bfe.s32 %r3, %r2, 0, 8;
1330 ; CHECK-NEXT: cvt.s8.s32 %rs1, %r3;
1331 ; CHECK-NEXT: bfe.s32 %r4, %r1, 0, 8;
1332 ; CHECK-NEXT: cvt.s8.s32 %rs2, %r4;
1333 ; CHECK-NEXT: rem.s16 %rs3, %rs2, %rs1;
1334 ; CHECK-NEXT: cvt.u32.u16 %r5, %rs3;
1335 ; CHECK-NEXT: bfe.s32 %r6, %r2, 8, 8;
1336 ; CHECK-NEXT: cvt.s8.s32 %rs4, %r6;
1337 ; CHECK-NEXT: bfe.s32 %r7, %r1, 8, 8;
1338 ; CHECK-NEXT: cvt.s8.s32 %rs5, %r7;
1339 ; CHECK-NEXT: rem.s16 %rs6, %rs5, %rs4;
1340 ; CHECK-NEXT: cvt.u32.u16 %r8, %rs6;
1341 ; CHECK-NEXT: bfi.b32 %r9, %r8, %r5, 8, 8;
1342 ; CHECK-NEXT: bfe.s32 %r10, %r2, 16, 8;
1343 ; CHECK-NEXT: cvt.s8.s32 %rs7, %r10;
1344 ; CHECK-NEXT: bfe.s32 %r11, %r1, 16, 8;
1345 ; CHECK-NEXT: cvt.s8.s32 %rs8, %r11;
1346 ; CHECK-NEXT: rem.s16 %rs9, %rs8, %rs7;
1347 ; CHECK-NEXT: cvt.u32.u16 %r12, %rs9;
1348 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r9, 16, 8;
1349 ; CHECK-NEXT: bfe.s32 %r14, %r2, 24, 8;
1350 ; CHECK-NEXT: cvt.s8.s32 %rs10, %r14;
1351 ; CHECK-NEXT: bfe.s32 %r15, %r1, 24, 8;
1352 ; CHECK-NEXT: cvt.s8.s32 %rs11, %r15;
1353 ; CHECK-NEXT: rem.s16 %rs12, %rs11, %rs10;
1354 ; CHECK-NEXT: cvt.u32.u16 %r16, %rs12;
1355 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r13, 24, 8;
1356 ; CHECK-NEXT: st.u32 [%rd3], %r17;
1359 %t57 = load <4 x i8>, ptr %a, align 4
1360 %t59 = load <4 x i8>, ptr %b, align 4
1361 %x = srem <4 x i8> %t57, %t59
1362 store <4 x i8> %x, ptr %c, align 4
1366 ;; v3i8 lowering, especially for unaligned loads is terrible. We end up doing
1367 ;; tons of pointless scalar_to_vector/bitcast/extract_elt on v2i16/v4i8, which
1368 ;; is further complicated by LLVM trying to use i16 as an intermediate type,
1369 ;; because we don't have i8 registers. It's a mess.
1370 ;; Ideally we want to split it into element-wise ops, but legalizer can't handle
1371 ;; odd-sized vectors. TL;DR; don't use odd-sized vectors of v8.
1372 define void @test_srem_v3i8(ptr %a, ptr %b, ptr %c) {
1373 ; CHECK-LABEL: test_srem_v3i8(
1375 ; CHECK-NEXT: .reg .b16 %rs<20>;
1376 ; CHECK-NEXT: .reg .b32 %r<16>;
1377 ; CHECK-NEXT: .reg .b64 %rd<4>;
1379 ; CHECK-NEXT: // %bb.0: // %entry
1380 ; CHECK-NEXT: ld.param.u64 %rd3, [test_srem_v3i8_param_2];
1381 ; CHECK-NEXT: ld.param.u64 %rd2, [test_srem_v3i8_param_1];
1382 ; CHECK-NEXT: ld.param.u64 %rd1, [test_srem_v3i8_param_0];
1383 ; CHECK-NEXT: ld.u8 %rs1, [%rd1];
1384 ; CHECK-NEXT: ld.u8 %rs2, [%rd1+1];
1385 ; CHECK-NEXT: shl.b16 %rs3, %rs2, 8;
1386 ; CHECK-NEXT: or.b16 %rs4, %rs3, %rs1;
1387 ; CHECK-NEXT: cvt.u32.u16 %r1, %rs4;
1388 ; CHECK-NEXT: ld.s8 %rs5, [%rd1+2];
1389 ; CHECK-NEXT: ld.u8 %rs6, [%rd2];
1390 ; CHECK-NEXT: ld.u8 %rs7, [%rd2+1];
1391 ; CHECK-NEXT: shl.b16 %rs8, %rs7, 8;
1392 ; CHECK-NEXT: or.b16 %rs9, %rs8, %rs6;
1393 ; CHECK-NEXT: cvt.u32.u16 %r3, %rs9;
1394 ; CHECK-NEXT: ld.s8 %rs10, [%rd2+2];
1395 ; CHECK-NEXT: bfe.s32 %r5, %r3, 0, 8;
1396 ; CHECK-NEXT: cvt.s8.s32 %rs11, %r5;
1397 ; CHECK-NEXT: bfe.s32 %r6, %r1, 0, 8;
1398 ; CHECK-NEXT: cvt.s8.s32 %rs12, %r6;
1399 ; CHECK-NEXT: rem.s16 %rs13, %rs12, %rs11;
1400 ; CHECK-NEXT: cvt.u32.u16 %r7, %rs13;
1401 ; CHECK-NEXT: bfe.s32 %r8, %r3, 8, 8;
1402 ; CHECK-NEXT: cvt.s8.s32 %rs14, %r8;
1403 ; CHECK-NEXT: bfe.s32 %r9, %r1, 8, 8;
1404 ; CHECK-NEXT: cvt.s8.s32 %rs15, %r9;
1405 ; CHECK-NEXT: rem.s16 %rs16, %rs15, %rs14;
1406 ; CHECK-NEXT: cvt.u32.u16 %r10, %rs16;
1407 ; CHECK-NEXT: bfi.b32 %r11, %r10, %r7, 8, 8;
1408 ; CHECK-NEXT: // implicit-def: %r13
1409 ; CHECK-NEXT: bfi.b32 %r12, %r13, %r11, 16, 8;
1410 ; CHECK-NEXT: // implicit-def: %r15
1411 ; CHECK-NEXT: bfi.b32 %r14, %r15, %r12, 24, 8;
1412 ; CHECK-NEXT: rem.s16 %rs17, %rs5, %rs10;
1413 ; CHECK-NEXT: cvt.u16.u32 %rs18, %r14;
1414 ; CHECK-NEXT: st.u8 [%rd3], %rs18;
1415 ; CHECK-NEXT: shr.u16 %rs19, %rs18, 8;
1416 ; CHECK-NEXT: st.u8 [%rd3+1], %rs19;
1417 ; CHECK-NEXT: st.u8 [%rd3+2], %rs17;
1420 %t57 = load <3 x i8>, ptr %a, align 1
1421 %t59 = load <3 x i8>, ptr %b, align 1
1422 %x = srem <3 x i8> %t57, %t59
1423 store <3 x i8> %x, ptr %c, align 1
1427 define void @test_sext_v4i1_to_v4i8(ptr %a, ptr %b, ptr %c) {
1428 ; CHECK-LABEL: test_sext_v4i1_to_v4i8(
1430 ; CHECK-NEXT: .reg .pred %p<5>;
1431 ; CHECK-NEXT: .reg .b32 %r<18>;
1432 ; CHECK-NEXT: .reg .b64 %rd<4>;
1434 ; CHECK-NEXT: // %bb.0: // %entry
1435 ; CHECK-NEXT: ld.param.u64 %rd3, [test_sext_v4i1_to_v4i8_param_2];
1436 ; CHECK-NEXT: ld.param.u64 %rd2, [test_sext_v4i1_to_v4i8_param_1];
1437 ; CHECK-NEXT: ld.param.u64 %rd1, [test_sext_v4i1_to_v4i8_param_0];
1438 ; CHECK-NEXT: ld.u32 %r1, [%rd1];
1439 ; CHECK-NEXT: ld.u32 %r2, [%rd2];
1440 ; CHECK-NEXT: bfe.u32 %r3, %r2, 24, 8;
1441 ; CHECK-NEXT: bfe.u32 %r4, %r1, 24, 8;
1442 ; CHECK-NEXT: setp.hi.u32 %p1, %r4, %r3;
1443 ; CHECK-NEXT: bfe.u32 %r5, %r2, 16, 8;
1444 ; CHECK-NEXT: bfe.u32 %r6, %r1, 16, 8;
1445 ; CHECK-NEXT: setp.hi.u32 %p2, %r6, %r5;
1446 ; CHECK-NEXT: bfe.u32 %r7, %r2, 8, 8;
1447 ; CHECK-NEXT: bfe.u32 %r8, %r1, 8, 8;
1448 ; CHECK-NEXT: setp.hi.u32 %p3, %r8, %r7;
1449 ; CHECK-NEXT: bfe.u32 %r9, %r2, 0, 8;
1450 ; CHECK-NEXT: bfe.u32 %r10, %r1, 0, 8;
1451 ; CHECK-NEXT: setp.hi.u32 %p4, %r10, %r9;
1452 ; CHECK-NEXT: selp.s32 %r11, -1, 0, %p4;
1453 ; CHECK-NEXT: selp.s32 %r12, -1, 0, %p3;
1454 ; CHECK-NEXT: bfi.b32 %r13, %r12, %r11, 8, 8;
1455 ; CHECK-NEXT: selp.s32 %r14, -1, 0, %p2;
1456 ; CHECK-NEXT: bfi.b32 %r15, %r14, %r13, 16, 8;
1457 ; CHECK-NEXT: selp.s32 %r16, -1, 0, %p1;
1458 ; CHECK-NEXT: bfi.b32 %r17, %r16, %r15, 24, 8;
1459 ; CHECK-NEXT: st.u32 [%rd3], %r17;
1462 %t1 = load <4 x i8>, ptr %a, align 4
1463 %t2 = load <4 x i8>, ptr %b, align 4
1464 %t5 = icmp ugt <4 x i8> %t1, %t2
1465 %t6 = sext <4 x i1> %t5 to <4 x i8>
1466 store <4 x i8> %t6, ptr %c, align 4
1470 attributes #0 = { nounwind }