1; Test vector shift left double immediate.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; Test a v16i8 shift with the lowest useful shift amount.
6define <16 x i8> @f1(<16 x i8> %val1, <16 x i8> %val2) {
7; CHECK-LABEL: f1:
8; CHECK: vsldb %v24, %v24, %v26, 1
9; CHECK: br %r14
10  %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
11                       <16 x i32> <i32 1, i32 2, i32 3, i32 4,
12                                   i32 5, i32 6, i32 7, i32 8,
13                                   i32 9, i32 10, i32 11, i32 12,
14                                   i32 13, i32 14, i32 15, i32 16>
15  ret <16 x i8> %ret
16}
17
18; Test a v16i8 shift with the highest shift amount.
19define <16 x i8> @f2(<16 x i8> %val1, <16 x i8> %val2) {
20; CHECK-LABEL: f2:
21; CHECK: vsldb %v24, %v24, %v26, 15
22; CHECK: br %r14
23  %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
24                       <16 x i32> <i32 15, i32 16, i32 17, i32 18,
25                                   i32 19, i32 20, i32 21, i32 22,
26                                   i32 23, i32 24, i32 25, i32 26,
27                                   i32 27, i32 28, i32 29, i32 30>
28  ret <16 x i8> %ret
29}
30
31; Test a v16i8 shift in which the operands need to be reversed.
32define <16 x i8> @f3(<16 x i8> %val1, <16 x i8> %val2) {
33; CHECK-LABEL: f3:
34; CHECK: vsldb %v24, %v26, %v24, 4
35; CHECK: br %r14
36  %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
37                       <16 x i32> <i32 20, i32 21, i32 22, i32 23,
38                                   i32 24, i32 25, i32 26, i32 27,
39                                   i32 28, i32 29, i32 30, i32 31,
40                                   i32 0, i32 1, i32 2, i32 3>
41  ret <16 x i8> %ret
42}
43
44; Test a v16i8 shift in which the operands need to be duplicated.
45define <16 x i8> @f4(<16 x i8> %val) {
46; CHECK-LABEL: f4:
47; CHECK: vsldb %v24, %v24, %v24, 7
48; CHECK: br %r14
49  %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
50                       <16 x i32> <i32 7, i32 8, i32 9, i32 10,
51                                   i32 11, i32 12, i32 13, i32 14,
52                                   i32 15, i32 0, i32 1, i32 2,
53                                   i32 3, i32 4, i32 5, i32 6>
54  ret <16 x i8> %ret
55}
56
57; Test a v16i8 shift in which some of the indices are undefs.
58define <16 x i8> @f5(<16 x i8> %val1, <16 x i8> %val2) {
59; CHECK-LABEL: f5:
60; CHECK: vsldb %v24, %v24, %v26, 11
61; CHECK: br %r14
62  %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
63                       <16 x i32> <i32 undef, i32 undef, i32 undef, i32 undef,
64                                   i32 15, i32 16, i32 undef, i32 18,
65                                   i32 19, i32 20, i32 21, i32 22,
66                                   i32 23, i32 24, i32 25, i32 26>
67  ret <16 x i8> %ret
68}
69
70; ...and again with reversed operands.
71define <16 x i8> @f6(<16 x i8> %val1, <16 x i8> %val2) {
72; CHECK-LABEL: f6:
73; CHECK: vsldb %v24, %v26, %v24, 13
74; CHECK: br %r14
75  %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
76                       <16 x i32> <i32 undef, i32 undef, i32 31, i32 0,
77                                   i32 1, i32 2, i32 3, i32 4,
78                                   i32 5, i32 6, i32 7, i32 8,
79                                   i32 9, i32 10, i32 11, i32 12>
80  ret <16 x i8> %ret
81}
82
83; Test a v8i16 shift with the lowest useful shift amount.
84define <8 x i16> @f7(<8 x i16> %val1, <8 x i16> %val2) {
85; CHECK-LABEL: f7:
86; CHECK: vsldb %v24, %v24, %v26, 2
87; CHECK: br %r14
88  %ret = shufflevector <8 x i16> %val1, <8 x i16> %val2,
89                       <8 x i32> <i32 1, i32 2, i32 3, i32 4,
90                                  i32 5, i32 6, i32 7, i32 8>
91  ret <8 x i16> %ret
92}
93
94; Test a v8i16 shift with the highest useful shift amount.
95define <8 x i16> @f8(<8 x i16> %val1, <8 x i16> %val2) {
96; CHECK-LABEL: f8:
97; CHECK: vsldb %v24, %v24, %v26, 14
98; CHECK: br %r14
99  %ret = shufflevector <8 x i16> %val1, <8 x i16> %val2,
100                       <8 x i32> <i32 7, i32 8, i32 9, i32 10,
101                                  i32 11, i32 12, i32 13, i32 14>
102  ret <8 x i16> %ret
103}
104
105; Test a v4i32 shift with the lowest useful shift amount.
106define <4 x i32> @f9(<4 x i32> %val1, <4 x i32> %val2) {
107; CHECK-LABEL: f9:
108; CHECK: vsldb %v24, %v24, %v26, 4
109; CHECK: br %r14
110  %ret = shufflevector <4 x i32> %val1, <4 x i32> %val2,
111                       <4 x i32> <i32 1, i32 2, i32 3, i32 4>
112  ret <4 x i32> %ret
113}
114
115; Test a v4i32 shift with the highest useful shift amount.
116define <4 x i32> @f10(<4 x i32> %val1, <4 x i32> %val2) {
117; CHECK-LABEL: f10:
118; CHECK: vsldb %v24, %v24, %v26, 12
119; CHECK: br %r14
120  %ret = shufflevector <4 x i32> %val1, <4 x i32> %val2,
121                       <4 x i32> <i32 3, i32 4, i32 5, i32 6>
122  ret <4 x i32> %ret
123}
124
125; Test a v4f32 shift with the lowest useful shift amount.
126define <4 x float> @f12(<4 x float> %val1, <4 x float> %val2) {
127; CHECK-LABEL: f12:
128; CHECK: vsldb %v24, %v24, %v26, 4
129; CHECK: br %r14
130  %ret = shufflevector <4 x float> %val1, <4 x float> %val2,
131                       <4 x i32> <i32 1, i32 2, i32 3, i32 4>
132  ret <4 x float> %ret
133}
134
135; Test a v4f32 shift with the highest useful shift amount.
136define <4 x float> @f13(<4 x float> %val1, <4 x float> %val2) {
137; CHECK-LABEL: f13:
138; CHECK: vsldb %v24, %v24, %v26, 12
139; CHECK: br %r14
140  %ret = shufflevector <4 x float> %val1, <4 x float> %val2,
141                       <4 x i32> <i32 3, i32 4, i32 5, i32 6>
142  ret <4 x float> %ret
143}
144
145; We use VPDI for v2i64 shuffles.
146