1 ; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s
3 ; test vector shifts converted to proper SSE2 vector shifts when the shift
4 ; amounts are the same when using a shuffle splat.
6 define void @shift1a(<2 x i64> %val, <2 x i64>* %dst, <2 x i64> %sh) nounwind {
8 ; CHECK-LABEL: shift1a:
10 %shamt = shufflevector <2 x i64> %sh, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
11 %shl = shl <2 x i64> %val, %shamt
12 store <2 x i64> %shl, <2 x i64>* %dst
16 ; shift1b can't use a packed shift
17 define void @shift1b(<2 x i64> %val, <2 x i64>* %dst, <2 x i64> %sh) nounwind {
19 ; CHECK-LABEL: shift1b:
21 %shamt = shufflevector <2 x i64> %sh, <2 x i64> undef, <2 x i32> <i32 0, i32 1>
22 %shl = shl <2 x i64> %val, %shamt
23 store <2 x i64> %shl, <2 x i64>* %dst
27 define void @shift2a(<4 x i32> %val, <4 x i32>* %dst, <2 x i32> %amt) nounwind {
29 ; CHECK-LABEL: shift2a:
31 %shamt = shufflevector <2 x i32> %amt, <2 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
32 %shl = shl <4 x i32> %val, %shamt
33 store <4 x i32> %shl, <4 x i32>* %dst
37 define void @shift2b(<4 x i32> %val, <4 x i32>* %dst, <2 x i32> %amt) nounwind {
39 ; CHECK-LABEL: shift2b:
41 %shamt = shufflevector <2 x i32> %amt, <2 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 1, i32 1>
42 %shl = shl <4 x i32> %val, %shamt
43 store <4 x i32> %shl, <4 x i32>* %dst
47 define void @shift2c(<4 x i32> %val, <4 x i32>* %dst, <2 x i32> %amt) nounwind {
49 ; CHECK-LABEL: shift2c:
51 %shamt = shufflevector <2 x i32> %amt, <2 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
52 %shl = shl <4 x i32> %val, %shamt
53 store <4 x i32> %shl, <4 x i32>* %dst
57 define void @shift3a(<8 x i16> %val, <8 x i16>* %dst, <8 x i16> %amt) nounwind {
59 ; CHECK-LABEL: shift3a:
62 %shamt = shufflevector <8 x i16> %amt, <8 x i16> undef, <8 x i32> <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
63 %shl = shl <8 x i16> %val, %shamt
64 store <8 x i16> %shl, <8 x i16>* %dst
68 define void @shift3b(<8 x i16> %val, <8 x i16>* %dst, i16 %amt) nounwind {
70 ; CHECK-LABEL: shift3b:
73 %0 = insertelement <8 x i16> undef, i16 %amt, i32 0
74 %1 = insertelement <8 x i16> %0, i16 %amt, i32 1
75 %2 = insertelement <8 x i16> %1, i16 %amt, i32 2
76 %3 = insertelement <8 x i16> %2, i16 %amt, i32 3
77 %4 = insertelement <8 x i16> %3, i16 %amt, i32 4
78 %5 = insertelement <8 x i16> %4, i16 %amt, i32 5
79 %6 = insertelement <8 x i16> %5, i16 %amt, i32 6
80 %7 = insertelement <8 x i16> %6, i16 %amt, i32 7
81 %shl = shl <8 x i16> %val, %7
82 store <8 x i16> %shl, <8 x i16>* %dst