• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s
2
3; test vector shifts converted to proper SSE2 vector shifts when the shift
4; amounts are the same.
5
6define void @shift1a(<2 x i64> %val, <2 x i64>* %dst) nounwind {
7entry:
8; CHECK-LABEL: shift1a:
9; CHECK: psllq
10  %shl = shl <2 x i64> %val, < i64 32, i64 32 >
11  store <2 x i64> %shl, <2 x i64>* %dst
12  ret void
13}
14
15define void @shift1b(<2 x i64> %val, <2 x i64>* %dst, i64 %amt) nounwind {
16entry:
17; CHECK-LABEL: shift1b:
18; CHECK: movd
19; CHECK: psllq
20  %0 = insertelement <2 x i64> undef, i64 %amt, i32 0
21  %1 = insertelement <2 x i64> %0, i64 %amt, i32 1
22  %shl = shl <2 x i64> %val, %1
23  store <2 x i64> %shl, <2 x i64>* %dst
24  ret void
25}
26
27
28define void @shift2a(<4 x i32> %val, <4 x i32>* %dst) nounwind {
29entry:
30; CHECK-LABEL: shift2a:
31; CHECK: pslld
32  %shl = shl <4 x i32> %val, < i32 5, i32 5, i32 5, i32 5 >
33  store <4 x i32> %shl, <4 x i32>* %dst
34  ret void
35}
36
37define void @shift2b(<4 x i32> %val, <4 x i32>* %dst, i32 %amt) nounwind {
38entry:
39; CHECK-LABEL: shift2b:
40; CHECK: movd
41; CHECK: pslld
42  %0 = insertelement <4 x i32> undef, i32 %amt, i32 0
43  %1 = insertelement <4 x i32> %0, i32 %amt, i32 1
44  %2 = insertelement <4 x i32> %1, i32 %amt, i32 2
45  %3 = insertelement <4 x i32> %2, i32 %amt, i32 3
46  %shl = shl <4 x i32> %val, %3
47  store <4 x i32> %shl, <4 x i32>* %dst
48  ret void
49}
50
51define void @shift3a(<8 x i16> %val, <8 x i16>* %dst) nounwind {
52entry:
53; CHECK-LABEL: shift3a:
54; CHECK: psllw
55  %shl = shl <8 x i16> %val, < i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5 >
56  store <8 x i16> %shl, <8 x i16>* %dst
57  ret void
58}
59
60; Make sure the shift amount is properly zero extended.
61define void @shift3b(<8 x i16> %val, <8 x i16>* %dst, i16 %amt) nounwind {
62entry:
63; CHECK-LABEL: shift3b:
64; CHECK: movzwl
65; CHECK: movd
66; CHECK-NEXT: psllw
67  %0 = insertelement <8 x i16> undef, i16 %amt, i32 0
68  %1 = insertelement <8 x i16> %0, i16 %amt, i32 1
69  %2 = insertelement <8 x i16> %1, i16 %amt, i32 2
70  %3 = insertelement <8 x i16> %2, i16 %amt, i32 3
71  %4 = insertelement <8 x i16> %3, i16 %amt, i32 4
72  %5 = insertelement <8 x i16> %4, i16 %amt, i32 5
73  %6 = insertelement <8 x i16> %5, i16 %amt, i32 6
74  %7 = insertelement <8 x i16> %6, i16 %amt, i32 7
75  %shl = shl <8 x i16> %val, %7
76  store <8 x i16> %shl, <8 x i16>* %dst
77  ret void
78}
79
80