1; Test vector splat.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; Test v16i8 splat of the first element.
6define <16 x i8> @f1(<16 x i8> %val) {
7; CHECK-LABEL: f1:
8; CHECK: vrepb %v24, %v24, 0
9; CHECK: br %r14
10  %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
11                       <16 x i32> zeroinitializer
12  ret <16 x i8> %ret
13}
14
15; Test v16i8 splat of the last element.
16define <16 x i8> @f2(<16 x i8> %val) {
17; CHECK-LABEL: f2:
18; CHECK: vrepb %v24, %v24, 15
19; CHECK: br %r14
20  %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
21                       <16 x i32> <i32 15, i32 15, i32 15, i32 15,
22                                   i32 15, i32 15, i32 15, i32 15,
23                                   i32 15, i32 15, i32 15, i32 15,
24                                   i32 15, i32 15, i32 15, i32 15>
25  ret <16 x i8> %ret
26}
27
28; Test v16i8 splat of an arbitrary element, using the second operand of
29; the shufflevector.
30define <16 x i8> @f3(<16 x i8> %val) {
31; CHECK-LABEL: f3:
32; CHECK: vrepb %v24, %v24, 4
33; CHECK: br %r14
34  %ret = shufflevector <16 x i8> undef, <16 x i8> %val,
35                       <16 x i32> <i32 20, i32 20, i32 20, i32 20,
36                                   i32 20, i32 20, i32 20, i32 20,
37                                   i32 20, i32 20, i32 20, i32 20,
38                                   i32 20, i32 20, i32 20, i32 20>
39  ret <16 x i8> %ret
40}
41
42; Test v8i16 splat of the first element.
43define <8 x i16> @f4(<8 x i16> %val) {
44; CHECK-LABEL: f4:
45; CHECK: vreph %v24, %v24, 0
46; CHECK: br %r14
47  %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
48                       <8 x i32> zeroinitializer
49  ret <8 x i16> %ret
50}
51
52; Test v8i16 splat of the last element.
53define <8 x i16> @f5(<8 x i16> %val) {
54; CHECK-LABEL: f5:
55; CHECK: vreph %v24, %v24, 7
56; CHECK: br %r14
57  %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
58                       <8 x i32> <i32 7, i32 7, i32 7, i32 7,
59                                  i32 7, i32 7, i32 7, i32 7>
60  ret <8 x i16> %ret
61}
62
63; Test v8i16 splat of an arbitrary element, using the second operand of
64; the shufflevector.
65define <8 x i16> @f6(<8 x i16> %val) {
66; CHECK-LABEL: f6:
67; CHECK: vreph %v24, %v24, 2
68; CHECK: br %r14
69  %ret = shufflevector <8 x i16> undef, <8 x i16> %val,
70                       <8 x i32> <i32 10, i32 10, i32 10, i32 10,
71                                  i32 10, i32 10, i32 10, i32 10>
72  ret <8 x i16> %ret
73}
74
75; Test v4i32 splat of the first element.
76define <4 x i32> @f7(<4 x i32> %val) {
77; CHECK-LABEL: f7:
78; CHECK: vrepf %v24, %v24, 0
79; CHECK: br %r14
80  %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
81                       <4 x i32> zeroinitializer
82  ret <4 x i32> %ret
83}
84
85; Test v4i32 splat of the last element.
86define <4 x i32> @f8(<4 x i32> %val) {
87; CHECK-LABEL: f8:
88; CHECK: vrepf %v24, %v24, 3
89; CHECK: br %r14
90  %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
91                       <4 x i32> <i32 3, i32 3, i32 3, i32 3>
92  ret <4 x i32> %ret
93}
94
95; Test v4i32 splat of an arbitrary element, using the second operand of
96; the shufflevector.
97define <4 x i32> @f9(<4 x i32> %val) {
98; CHECK-LABEL: f9:
99; CHECK: vrepf %v24, %v24, 1
100; CHECK: br %r14
101  %ret = shufflevector <4 x i32> undef, <4 x i32> %val,
102                       <4 x i32> <i32 5, i32 5, i32 5, i32 5>
103  ret <4 x i32> %ret
104}
105
106; Test v2i64 splat of the first element.
107define <2 x i64> @f10(<2 x i64> %val) {
108; CHECK-LABEL: f10:
109; CHECK: vrepg %v24, %v24, 0
110; CHECK: br %r14
111  %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
112                       <2 x i32> zeroinitializer
113  ret <2 x i64> %ret
114}
115
116; Test v2i64 splat of the last element.
117define <2 x i64> @f11(<2 x i64> %val) {
118; CHECK-LABEL: f11:
119; CHECK: vrepg %v24, %v24, 1
120; CHECK: br %r14
121  %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
122                       <2 x i32> <i32 1, i32 1>
123  ret <2 x i64> %ret
124}
125
126; Test v4f32 splat of the first element.
127define <4 x float> @f12(<4 x float> %val) {
128; CHECK-LABEL: f12:
129; CHECK: vrepf %v24, %v24, 0
130; CHECK: br %r14
131  %ret = shufflevector <4 x float> %val, <4 x float> undef,
132                       <4 x i32> zeroinitializer
133  ret <4 x float> %ret
134}
135
136; Test v4f32 splat of the last element.
137define <4 x float> @f13(<4 x float> %val) {
138; CHECK-LABEL: f13:
139; CHECK: vrepf %v24, %v24, 3
140; CHECK: br %r14
141  %ret = shufflevector <4 x float> %val, <4 x float> undef,
142                       <4 x i32> <i32 3, i32 3, i32 3, i32 3>
143  ret <4 x float> %ret
144}
145
146; Test v4f32 splat of an arbitrary element, using the second operand of
147; the shufflevector.
148define <4 x float> @f14(<4 x float> %val) {
149; CHECK-LABEL: f14:
150; CHECK: vrepf %v24, %v24, 1
151; CHECK: br %r14
152  %ret = shufflevector <4 x float> undef, <4 x float> %val,
153                       <4 x i32> <i32 5, i32 5, i32 5, i32 5>
154  ret <4 x float> %ret
155}
156
157; Test v2f64 splat of the first element.
158define <2 x double> @f15(<2 x double> %val) {
159; CHECK-LABEL: f15:
160; CHECK: vrepg %v24, %v24, 0
161; CHECK: br %r14
162  %ret = shufflevector <2 x double> %val, <2 x double> undef,
163                       <2 x i32> zeroinitializer
164  ret <2 x double> %ret
165}
166
167; Test v2f64 splat of the last element.
168define <2 x double> @f16(<2 x double> %val) {
169; CHECK-LABEL: f16:
170; CHECK: vrepg %v24, %v24, 1
171; CHECK: br %r14
172  %ret = shufflevector <2 x double> %val, <2 x double> undef,
173                       <2 x i32> <i32 1, i32 1>
174  ret <2 x double> %ret
175}
176