1 ; Test replications of a scalar register value, represented as splats.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test v16i8 splat of the first element.
6 define <16 x i8> @f1(i8 %scalar) {
8 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
9 ; CHECK: vrepb %v24, [[REG]], 7
11 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
12 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
13 <16 x i32> zeroinitializer
17 ; Test v16i8 splat of the last element.
18 define <16 x i8> @f2(i8 %scalar) {
20 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
21 ; CHECK: vrepb %v24, [[REG]], 7
23 %val = insertelement <16 x i8> undef, i8 %scalar, i32 15
24 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
25 <16 x i32> <i32 15, i32 15, i32 15, i32 15,
26 i32 15, i32 15, i32 15, i32 15,
27 i32 15, i32 15, i32 15, i32 15,
28 i32 15, i32 15, i32 15, i32 15>
32 ; Test v16i8 splat of an arbitrary element, using the second operand of
34 define <16 x i8> @f3(i8 %scalar) {
36 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
37 ; CHECK: vrepb %v24, [[REG]], 7
39 %val = insertelement <16 x i8> undef, i8 %scalar, i32 4
40 %ret = shufflevector <16 x i8> undef, <16 x i8> %val,
41 <16 x i32> <i32 20, i32 20, i32 20, i32 20,
42 i32 20, i32 20, i32 20, i32 20,
43 i32 20, i32 20, i32 20, i32 20,
44 i32 20, i32 20, i32 20, i32 20>
48 ; Test v8i16 splat of the first element.
49 define <8 x i16> @f4(i16 %scalar) {
51 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
52 ; CHECK: vreph %v24, [[REG]], 3
54 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0
55 %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
56 <8 x i32> zeroinitializer
60 ; Test v8i16 splat of the last element.
61 define <8 x i16> @f5(i16 %scalar) {
63 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
64 ; CHECK: vreph %v24, [[REG]], 3
66 %val = insertelement <8 x i16> undef, i16 %scalar, i32 7
67 %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
68 <8 x i32> <i32 7, i32 7, i32 7, i32 7,
69 i32 7, i32 7, i32 7, i32 7>
73 ; Test v8i16 splat of an arbitrary element, using the second operand of
75 define <8 x i16> @f6(i16 %scalar) {
77 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
78 ; CHECK: vreph %v24, [[REG]], 3
80 %val = insertelement <8 x i16> undef, i16 %scalar, i32 2
81 %ret = shufflevector <8 x i16> undef, <8 x i16> %val,
82 <8 x i32> <i32 10, i32 10, i32 10, i32 10,
83 i32 10, i32 10, i32 10, i32 10>
87 ; Test v4i32 splat of the first element.
88 define <4 x i32> @f7(i32 %scalar) {
90 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
91 ; CHECK: vrepf %v24, [[REG]], 1
93 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0
94 %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
95 <4 x i32> zeroinitializer
99 ; Test v4i32 splat of the last element.
100 define <4 x i32> @f8(i32 %scalar) {
102 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
103 ; CHECK: vrepf %v24, [[REG]], 1
105 %val = insertelement <4 x i32> undef, i32 %scalar, i32 3
106 %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
107 <4 x i32> <i32 3, i32 3, i32 3, i32 3>
111 ; Test v4i32 splat of an arbitrary element, using the second operand of
113 define <4 x i32> @f9(i32 %scalar) {
115 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
116 ; CHECK: vrepf %v24, [[REG]], 1
118 %val = insertelement <4 x i32> undef, i32 %scalar, i32 1
119 %ret = shufflevector <4 x i32> undef, <4 x i32> %val,
120 <4 x i32> <i32 5, i32 5, i32 5, i32 5>
124 ; Test v2i64 splat of the first element.
125 define <2 x i64> @f10(i64 %scalar) {
127 ; CHECK: vlvgp %v24, %r2, %r2
129 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0
130 %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
131 <2 x i32> zeroinitializer
135 ; Test v2i64 splat of the last element.
136 define <2 x i64> @f11(i64 %scalar) {
138 ; CHECK: vlvgp %v24, %r2, %r2
140 %val = insertelement <2 x i64> undef, i64 %scalar, i32 1
141 %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
142 <2 x i32> <i32 1, i32 1>
146 ; Test v4f32 splat of the first element.
147 define <4 x float> @f12(float %scalar) {
149 ; CHECK: vrepf %v24, %v0, 0
151 %val = insertelement <4 x float> undef, float %scalar, i32 0
152 %ret = shufflevector <4 x float> %val, <4 x float> undef,
153 <4 x i32> zeroinitializer
157 ; Test v4f32 splat of the last element.
158 define <4 x float> @f13(float %scalar) {
160 ; CHECK: vrepf %v24, %v0, 0
162 %val = insertelement <4 x float> undef, float %scalar, i32 3
163 %ret = shufflevector <4 x float> %val, <4 x float> undef,
164 <4 x i32> <i32 3, i32 3, i32 3, i32 3>
168 ; Test v4f32 splat of an arbitrary element, using the second operand of
170 define <4 x float> @f14(float %scalar) {
172 ; CHECK: vrepf %v24, %v0, 0
174 %val = insertelement <4 x float> undef, float %scalar, i32 1
175 %ret = shufflevector <4 x float> undef, <4 x float> %val,
176 <4 x i32> <i32 5, i32 5, i32 5, i32 5>
180 ; Test v2f64 splat of the first element.
181 define <2 x double> @f15(double %scalar) {
183 ; CHECK: vrepg %v24, %v0, 0
185 %val = insertelement <2 x double> undef, double %scalar, i32 0
186 %ret = shufflevector <2 x double> %val, <2 x double> undef,
187 <2 x i32> zeroinitializer
188 ret <2 x double> %ret
191 ; Test v2f64 splat of the last element.
192 define <2 x double> @f16(double %scalar) {
194 ; CHECK: vrepg %v24, %v0, 0
196 %val = insertelement <2 x double> undef, double %scalar, i32 1
197 %ret = shufflevector <2 x double> %val, <2 x double> undef,
198 <2 x i32> <i32 1, i32 1>
199 ret <2 x double> %ret