1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+sse2 | FileCheck %s
4 ; SSE2 Logical Shift Left
6 define <8 x i16> @test_sllw_1(<8 x i16> %InVec) {
7 ; CHECK-LABEL: test_sllw_1:
8 ; CHECK: # %bb.0: # %entry
11 %shl = shl <8 x i16> %InVec, <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
15 define <8 x i16> @test_sllw_2(<8 x i16> %InVec) {
16 ; CHECK-LABEL: test_sllw_2:
17 ; CHECK: # %bb.0: # %entry
18 ; CHECK-NEXT: paddw %xmm0, %xmm0
21 %shl = shl <8 x i16> %InVec, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
25 define <8 x i16> @test_sllw_3(<8 x i16> %InVec) {
26 ; CHECK-LABEL: test_sllw_3:
27 ; CHECK: # %bb.0: # %entry
28 ; CHECK-NEXT: psllw $15, %xmm0
31 %shl = shl <8 x i16> %InVec, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
35 define <4 x i32> @test_slld_1(<4 x i32> %InVec) {
36 ; CHECK-LABEL: test_slld_1:
37 ; CHECK: # %bb.0: # %entry
40 %shl = shl <4 x i32> %InVec, <i32 0, i32 0, i32 0, i32 0>
44 define <4 x i32> @test_slld_2(<4 x i32> %InVec) {
45 ; CHECK-LABEL: test_slld_2:
46 ; CHECK: # %bb.0: # %entry
47 ; CHECK-NEXT: paddd %xmm0, %xmm0
50 %shl = shl <4 x i32> %InVec, <i32 1, i32 1, i32 1, i32 1>
54 define <4 x i32> @test_slld_3(<4 x i32> %InVec) {
55 ; CHECK-LABEL: test_slld_3:
56 ; CHECK: # %bb.0: # %entry
57 ; CHECK-NEXT: pslld $31, %xmm0
60 %shl = shl <4 x i32> %InVec, <i32 31, i32 31, i32 31, i32 31>
64 define <2 x i64> @test_sllq_1(<2 x i64> %InVec) {
65 ; CHECK-LABEL: test_sllq_1:
66 ; CHECK: # %bb.0: # %entry
69 %shl = shl <2 x i64> %InVec, <i64 0, i64 0>
73 define <2 x i64> @test_sllq_2(<2 x i64> %InVec) {
74 ; CHECK-LABEL: test_sllq_2:
75 ; CHECK: # %bb.0: # %entry
76 ; CHECK-NEXT: paddq %xmm0, %xmm0
79 %shl = shl <2 x i64> %InVec, <i64 1, i64 1>
83 define <2 x i64> @test_sllq_3(<2 x i64> %InVec) {
84 ; CHECK-LABEL: test_sllq_3:
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK-NEXT: psllq $63, %xmm0
89 %shl = shl <2 x i64> %InVec, <i64 63, i64 63>
93 ; SSE2 Arithmetic Shift
95 define <8 x i16> @test_sraw_1(<8 x i16> %InVec) {
96 ; CHECK-LABEL: test_sraw_1:
97 ; CHECK: # %bb.0: # %entry
100 %shl = ashr <8 x i16> %InVec, <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
104 define <8 x i16> @test_sraw_2(<8 x i16> %InVec) {
105 ; CHECK-LABEL: test_sraw_2:
106 ; CHECK: # %bb.0: # %entry
107 ; CHECK-NEXT: psraw $1, %xmm0
110 %shl = ashr <8 x i16> %InVec, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
114 define <8 x i16> @test_sraw_3(<8 x i16> %InVec) {
115 ; CHECK-LABEL: test_sraw_3:
116 ; CHECK: # %bb.0: # %entry
117 ; CHECK-NEXT: psraw $15, %xmm0
120 %shl = ashr <8 x i16> %InVec, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
124 define <4 x i32> @test_srad_1(<4 x i32> %InVec) {
125 ; CHECK-LABEL: test_srad_1:
126 ; CHECK: # %bb.0: # %entry
129 %shl = ashr <4 x i32> %InVec, <i32 0, i32 0, i32 0, i32 0>
133 define <4 x i32> @test_srad_2(<4 x i32> %InVec) {
134 ; CHECK-LABEL: test_srad_2:
135 ; CHECK: # %bb.0: # %entry
136 ; CHECK-NEXT: psrad $1, %xmm0
139 %shl = ashr <4 x i32> %InVec, <i32 1, i32 1, i32 1, i32 1>
143 define <4 x i32> @test_srad_3(<4 x i32> %InVec) {
144 ; CHECK-LABEL: test_srad_3:
145 ; CHECK: # %bb.0: # %entry
146 ; CHECK-NEXT: psrad $31, %xmm0
149 %shl = ashr <4 x i32> %InVec, <i32 31, i32 31, i32 31, i32 31>
153 ; SSE Logical Shift Right
155 define <8 x i16> @test_srlw_1(<8 x i16> %InVec) {
156 ; CHECK-LABEL: test_srlw_1:
157 ; CHECK: # %bb.0: # %entry
160 %shl = lshr <8 x i16> %InVec, <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
164 define <8 x i16> @test_srlw_2(<8 x i16> %InVec) {
165 ; CHECK-LABEL: test_srlw_2:
166 ; CHECK: # %bb.0: # %entry
167 ; CHECK-NEXT: psrlw $1, %xmm0
170 %shl = lshr <8 x i16> %InVec, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
174 define <8 x i16> @test_srlw_3(<8 x i16> %InVec) {
175 ; CHECK-LABEL: test_srlw_3:
176 ; CHECK: # %bb.0: # %entry
177 ; CHECK-NEXT: psrlw $15, %xmm0
180 %shl = lshr <8 x i16> %InVec, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
184 define <4 x i32> @test_srld_1(<4 x i32> %InVec) {
185 ; CHECK-LABEL: test_srld_1:
186 ; CHECK: # %bb.0: # %entry
189 %shl = lshr <4 x i32> %InVec, <i32 0, i32 0, i32 0, i32 0>
193 define <4 x i32> @test_srld_2(<4 x i32> %InVec) {
194 ; CHECK-LABEL: test_srld_2:
195 ; CHECK: # %bb.0: # %entry
196 ; CHECK-NEXT: psrld $1, %xmm0
199 %shl = lshr <4 x i32> %InVec, <i32 1, i32 1, i32 1, i32 1>
203 define <4 x i32> @test_srld_3(<4 x i32> %InVec) {
204 ; CHECK-LABEL: test_srld_3:
205 ; CHECK: # %bb.0: # %entry
206 ; CHECK-NEXT: psrld $31, %xmm0
209 %shl = lshr <4 x i32> %InVec, <i32 31, i32 31, i32 31, i32 31>
213 define <2 x i64> @test_srlq_1(<2 x i64> %InVec) {
214 ; CHECK-LABEL: test_srlq_1:
215 ; CHECK: # %bb.0: # %entry
218 %shl = lshr <2 x i64> %InVec, <i64 0, i64 0>
222 define <2 x i64> @test_srlq_2(<2 x i64> %InVec) {
223 ; CHECK-LABEL: test_srlq_2:
224 ; CHECK: # %bb.0: # %entry
225 ; CHECK-NEXT: psrlq $1, %xmm0
228 %shl = lshr <2 x i64> %InVec, <i64 1, i64 1>
232 define <2 x i64> @test_srlq_3(<2 x i64> %InVec) {
233 ; CHECK-LABEL: test_srlq_3:
234 ; CHECK: # %bb.0: # %entry
235 ; CHECK-NEXT: psrlq $63, %xmm0
238 %shl = lshr <2 x i64> %InVec, <i64 63, i64 63>
242 define <4 x i32> @sra_sra_v4i32(<4 x i32> %x) nounwind {
243 ; CHECK-LABEL: sra_sra_v4i32:
245 ; CHECK-NEXT: psrad $6, %xmm0
247 %sra0 = ashr <4 x i32> %x, <i32 2, i32 2, i32 2, i32 2>
248 %sra1 = ashr <4 x i32> %sra0, <i32 4, i32 4, i32 4, i32 4>
252 define <4 x i32> @srl_srl_v4i32(<4 x i32> %x) nounwind {
253 ; CHECK-LABEL: srl_srl_v4i32:
255 ; CHECK-NEXT: psrld $6, %xmm0
257 %srl0 = lshr <4 x i32> %x, <i32 2, i32 2, i32 2, i32 2>
258 %srl1 = lshr <4 x i32> %srl0, <i32 4, i32 4, i32 4, i32 4>
262 define <4 x i32> @srl_shl_v4i32(<4 x i32> %x) nounwind {
263 ; CHECK-LABEL: srl_shl_v4i32:
265 ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
267 %srl0 = shl <4 x i32> %x, <i32 4, i32 4, i32 4, i32 4>
268 %srl1 = lshr <4 x i32> %srl0, <i32 4, i32 4, i32 4, i32 4>
272 define <4 x i32> @srl_sra_31_v4i32(<4 x i32> %x, <4 x i32> %y) nounwind {
273 ; CHECK-LABEL: srl_sra_31_v4i32:
275 ; CHECK-NEXT: psrld $31, %xmm0
277 %sra = ashr <4 x i32> %x, %y
278 %srl1 = lshr <4 x i32> %sra, <i32 31, i32 31, i32 31, i32 31>
282 define <4 x i32> @shl_shl_v4i32(<4 x i32> %x) nounwind {
283 ; CHECK-LABEL: shl_shl_v4i32:
285 ; CHECK-NEXT: pslld $6, %xmm0
287 %shl0 = shl <4 x i32> %x, <i32 2, i32 2, i32 2, i32 2>
288 %shl1 = shl <4 x i32> %shl0, <i32 4, i32 4, i32 4, i32 4>
292 define <4 x i32> @shl_sra_v4i32(<4 x i32> %x) nounwind {
293 ; CHECK-LABEL: shl_sra_v4i32:
295 ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
297 %shl0 = ashr <4 x i32> %x, <i32 4, i32 4, i32 4, i32 4>
298 %shl1 = shl <4 x i32> %shl0, <i32 4, i32 4, i32 4, i32 4>
302 define <4 x i32> @shl_srl_v4i32(<4 x i32> %x) nounwind {
303 ; CHECK-LABEL: shl_srl_v4i32:
305 ; CHECK-NEXT: pslld $3, %xmm0
306 ; CHECK-NEXT: pand {{.*}}(%rip), %xmm0
308 %shl0 = lshr <4 x i32> %x, <i32 2, i32 2, i32 2, i32 2>
309 %shl1 = shl <4 x i32> %shl0, <i32 5, i32 5, i32 5, i32 5>
313 define <4 x i32> @shl_zext_srl_v4i32(<4 x i16> %x) nounwind {
314 ; CHECK-LABEL: shl_zext_srl_v4i32:
316 ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
317 ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
319 %srl = lshr <4 x i16> %x, <i16 2, i16 2, i16 2, i16 2>
320 %zext = zext <4 x i16> %srl to <4 x i32>
321 %shl = shl <4 x i32> %zext, <i32 2, i32 2, i32 2, i32 2>
325 define <4 x i16> @sra_trunc_srl_v4i32(<4 x i32> %x) nounwind {
326 ; CHECK-LABEL: sra_trunc_srl_v4i32:
328 ; CHECK-NEXT: psrad $19, %xmm0
330 %srl = lshr <4 x i32> %x, <i32 16, i32 16, i32 16, i32 16>
331 %trunc = trunc <4 x i32> %srl to <4 x i16>
332 %sra = ashr <4 x i16> %trunc, <i16 3, i16 3, i16 3, i16 3>
336 define <4 x i32> @shl_zext_shl_v4i32(<4 x i16> %x) nounwind {
337 ; CHECK-LABEL: shl_zext_shl_v4i32:
339 ; CHECK-NEXT: pslld $19, %xmm0
341 %shl0 = shl <4 x i16> %x, <i16 2, i16 2, i16 2, i16 2>
342 %ext = zext <4 x i16> %shl0 to <4 x i32>
343 %shl1 = shl <4 x i32> %ext, <i32 17, i32 17, i32 17, i32 17>
347 define <4 x i32> @sra_v4i32(<4 x i32> %x) nounwind {
348 ; CHECK-LABEL: sra_v4i32:
350 ; CHECK-NEXT: psrad $3, %xmm0
352 %sra = ashr <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
356 define <4 x i32> @srl_v4i32(<4 x i32> %x) nounwind {
357 ; CHECK-LABEL: srl_v4i32:
359 ; CHECK-NEXT: psrld $3, %xmm0
361 %sra = lshr <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
365 define <4 x i32> @shl_v4i32(<4 x i32> %x) nounwind {
366 ; CHECK-LABEL: shl_v4i32:
368 ; CHECK-NEXT: pslld $3, %xmm0
370 %sra = shl <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>