1 ; Test vector shift left with scalar shift amount.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test a v16i8 shift by a variable.
6 define <16 x i8> @f1(<16 x i8> %dummy, <16 x i8> %val1, i32 %shift) {
8 ; CHECK: veslb %v24, %v26, 0(%r2)
10 %truncshift = trunc i32 %shift to i8
11 %shiftvec = insertelement <16 x i8> undef, i8 %truncshift, i32 0
12 %val2 = shufflevector <16 x i8> %shiftvec, <16 x i8> undef,
13 <16 x i32> zeroinitializer
14 %ret = shl <16 x i8> %val1, %val2
18 ; Test a v16i8 shift by the lowest useful constant.
19 define <16 x i8> @f2(<16 x i8> %dummy, <16 x i8> %val) {
21 ; CHECK: veslb %v24, %v26, 1
23 %ret = shl <16 x i8> %val, <i8 1, i8 1, i8 1, i8 1,
24 i8 1, i8 1, i8 1, i8 1,
25 i8 1, i8 1, i8 1, i8 1,
26 i8 1, i8 1, i8 1, i8 1>
30 ; Test a v16i8 shift by the highest useful constant.
31 define <16 x i8> @f3(<16 x i8> %dummy, <16 x i8> %val) {
33 ; CHECK: veslb %v24, %v26, 7
35 %ret = shl <16 x i8> %val, <i8 7, i8 7, i8 7, i8 7,
36 i8 7, i8 7, i8 7, i8 7,
37 i8 7, i8 7, i8 7, i8 7,
38 i8 7, i8 7, i8 7, i8 7>
42 ; Test a v8i16 shift by a variable.
43 define <8 x i16> @f4(<8 x i16> %dummy, <8 x i16> %val1, i32 %shift) {
45 ; CHECK: veslh %v24, %v26, 0(%r2)
47 %truncshift = trunc i32 %shift to i16
48 %shiftvec = insertelement <8 x i16> undef, i16 %truncshift, i32 0
49 %val2 = shufflevector <8 x i16> %shiftvec, <8 x i16> undef,
50 <8 x i32> zeroinitializer
51 %ret = shl <8 x i16> %val1, %val2
55 ; Test a v8i16 shift by the lowest useful constant.
56 define <8 x i16> @f5(<8 x i16> %dummy, <8 x i16> %val) {
58 ; CHECK: veslh %v24, %v26, 1
60 %ret = shl <8 x i16> %val, <i16 1, i16 1, i16 1, i16 1,
61 i16 1, i16 1, i16 1, i16 1>
65 ; Test a v8i16 shift by the highest useful constant.
66 define <8 x i16> @f6(<8 x i16> %dummy, <8 x i16> %val) {
68 ; CHECK: veslh %v24, %v26, 15
70 %ret = shl <8 x i16> %val, <i16 15, i16 15, i16 15, i16 15,
71 i16 15, i16 15, i16 15, i16 15>
75 ; Test a v4i32 shift by a variable.
76 define <4 x i32> @f7(<4 x i32> %dummy, <4 x i32> %val1, i32 %shift) {
78 ; CHECK: veslf %v24, %v26, 0(%r2)
80 %shiftvec = insertelement <4 x i32> undef, i32 %shift, i32 0
81 %val2 = shufflevector <4 x i32> %shiftvec, <4 x i32> undef,
82 <4 x i32> zeroinitializer
83 %ret = shl <4 x i32> %val1, %val2
87 ; Test a v4i32 shift by the lowest useful constant.
88 define <4 x i32> @f8(<4 x i32> %dummy, <4 x i32> %val) {
90 ; CHECK: veslf %v24, %v26, 1
92 %ret = shl <4 x i32> %val, <i32 1, i32 1, i32 1, i32 1>
96 ; Test a v4i32 shift by the highest useful constant.
97 define <4 x i32> @f9(<4 x i32> %dummy, <4 x i32> %val) {
99 ; CHECK: veslf %v24, %v26, 31
101 %ret = shl <4 x i32> %val, <i32 31, i32 31, i32 31, i32 31>
105 ; Test a v2i64 shift by a variable.
106 define <2 x i64> @f10(<2 x i64> %dummy, <2 x i64> %val1, i32 %shift) {
108 ; CHECK: veslg %v24, %v26, 0(%r2)
110 %extshift = sext i32 %shift to i64
111 %shiftvec = insertelement <2 x i64> undef, i64 %extshift, i32 0
112 %val2 = shufflevector <2 x i64> %shiftvec, <2 x i64> undef,
113 <2 x i32> zeroinitializer
114 %ret = shl <2 x i64> %val1, %val2
118 ; Test a v2i64 shift by the lowest useful constant.
119 define <2 x i64> @f11(<2 x i64> %dummy, <2 x i64> %val) {
121 ; CHECK: veslg %v24, %v26, 1
123 %ret = shl <2 x i64> %val, <i64 1, i64 1>
127 ; Test a v2i64 shift by the highest useful constant.
128 define <2 x i64> @f12(<2 x i64> %dummy, <2 x i64> %val) {
130 ; CHECK: veslg %v24, %v26, 63
132 %ret = shl <2 x i64> %val, <i64 63, i64 63>