1 ; Test vector insertion of constants.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test v16i8 insertion into the first element.
6 define <16 x i8> @f1(<16 x i8> %val) {
8 ; CHECK: vleib %v24, 0, 0
10 %ret = insertelement <16 x i8> %val, i8 0, i32 0
14 ; Test v16i8 insertion into the last element.
15 define <16 x i8> @f2(<16 x i8> %val) {
17 ; CHECK: vleib %v24, 100, 15
19 %ret = insertelement <16 x i8> %val, i8 100, i32 15
23 ; Test v16i8 insertion with the maximum signed value.
24 define <16 x i8> @f3(<16 x i8> %val) {
26 ; CHECK: vleib %v24, 127, 10
28 %ret = insertelement <16 x i8> %val, i8 127, i32 10
32 ; Test v16i8 insertion with the minimum signed value.
33 define <16 x i8> @f4(<16 x i8> %val) {
35 ; CHECK: vleib %v24, -128, 11
37 %ret = insertelement <16 x i8> %val, i8 128, i32 11
41 ; Test v16i8 insertion with the maximum unsigned value.
42 define <16 x i8> @f5(<16 x i8> %val) {
44 ; CHECK: vleib %v24, -1, 12
46 %ret = insertelement <16 x i8> %val, i8 255, i32 12
50 ; Test v16i8 insertion into a variable element.
51 define <16 x i8> @f6(<16 x i8> %val, i32 %index) {
55 %ret = insertelement <16 x i8> %val, i8 0, i32 %index
59 ; Test v8i16 insertion into the first element.
60 define <8 x i16> @f7(<8 x i16> %val) {
62 ; CHECK: vleih %v24, 0, 0
64 %ret = insertelement <8 x i16> %val, i16 0, i32 0
68 ; Test v8i16 insertion into the last element.
69 define <8 x i16> @f8(<8 x i16> %val) {
71 ; CHECK: vleih %v24, 0, 7
73 %ret = insertelement <8 x i16> %val, i16 0, i32 7
77 ; Test v8i16 insertion with the maximum signed value.
78 define <8 x i16> @f9(<8 x i16> %val) {
80 ; CHECK: vleih %v24, 32767, 4
82 %ret = insertelement <8 x i16> %val, i16 32767, i32 4
86 ; Test v8i16 insertion with the minimum signed value.
87 define <8 x i16> @f10(<8 x i16> %val) {
89 ; CHECK: vleih %v24, -32768, 5
91 %ret = insertelement <8 x i16> %val, i16 32768, i32 5
95 ; Test v8i16 insertion with the maximum unsigned value.
96 define <8 x i16> @f11(<8 x i16> %val) {
98 ; CHECK: vleih %v24, -1, 6
100 %ret = insertelement <8 x i16> %val, i16 65535, i32 6
104 ; Test v8i16 insertion into a variable element.
105 define <8 x i16> @f12(<8 x i16> %val, i32 %index) {
109 %ret = insertelement <8 x i16> %val, i16 0, i32 %index
113 ; Test v4i32 insertion into the first element.
114 define <4 x i32> @f13(<4 x i32> %val) {
116 ; CHECK: vleif %v24, 0, 0
118 %ret = insertelement <4 x i32> %val, i32 0, i32 0
122 ; Test v4i32 insertion into the last element.
123 define <4 x i32> @f14(<4 x i32> %val) {
125 ; CHECK: vleif %v24, 0, 3
127 %ret = insertelement <4 x i32> %val, i32 0, i32 3
131 ; Test v4i32 insertion with the maximum value allowed by VLEIF.
132 define <4 x i32> @f15(<4 x i32> %val) {
134 ; CHECK: vleif %v24, 32767, 1
136 %ret = insertelement <4 x i32> %val, i32 32767, i32 1
140 ; Test v4i32 insertion with the next value up.
141 define <4 x i32> @f16(<4 x i32> %val) {
145 %ret = insertelement <4 x i32> %val, i32 32768, i32 1
149 ; Test v4i32 insertion with the minimum value allowed by VLEIF.
150 define <4 x i32> @f17(<4 x i32> %val) {
152 ; CHECK: vleif %v24, -32768, 2
154 %ret = insertelement <4 x i32> %val, i32 -32768, i32 2
158 ; Test v4i32 insertion with the next value down.
159 define <4 x i32> @f18(<4 x i32> %val) {
163 %ret = insertelement <4 x i32> %val, i32 -32769, i32 2
167 ; Test v4i32 insertion into a variable element.
168 define <4 x i32> @f19(<4 x i32> %val, i32 %index) {
172 %ret = insertelement <4 x i32> %val, i32 0, i32 %index
176 ; Test v2i64 insertion into the first element.
177 define <2 x i64> @f20(<2 x i64> %val) {
179 ; CHECK: vleig %v24, 0, 0
181 %ret = insertelement <2 x i64> %val, i64 0, i32 0
185 ; Test v2i64 insertion into the last element.
186 define <2 x i64> @f21(<2 x i64> %val) {
188 ; CHECK: vleig %v24, 0, 1
190 %ret = insertelement <2 x i64> %val, i64 0, i32 1
194 ; Test v2i64 insertion with the maximum value allowed by VLEIG.
195 define <2 x i64> @f22(<2 x i64> %val) {
197 ; CHECK: vleig %v24, 32767, 1
199 %ret = insertelement <2 x i64> %val, i64 32767, i32 1
203 ; Test v2i64 insertion with the next value up.
204 define <2 x i64> @f23(<2 x i64> %val) {
208 %ret = insertelement <2 x i64> %val, i64 32768, i32 1
212 ; Test v2i64 insertion with the minimum value allowed by VLEIG.
213 define <2 x i64> @f24(<2 x i64> %val) {
215 ; CHECK: vleig %v24, -32768, 0
217 %ret = insertelement <2 x i64> %val, i64 -32768, i32 0
221 ; Test v2i64 insertion with the next value down.
222 define <2 x i64> @f25(<2 x i64> %val) {
226 %ret = insertelement <2 x i64> %val, i64 -32769, i32 0
230 ; Test v2i64 insertion into a variable element.
231 define <2 x i64> @f26(<2 x i64> %val, i32 %index) {
235 %ret = insertelement <2 x i64> %val, i64 0, i32 %index
239 ; Test v4f32 insertion of 0 into the first element.
240 define <4 x float> @f27(<4 x float> %val) {
242 ; CHECK: vleif %v24, 0, 0
244 %ret = insertelement <4 x float> %val, float 0.0, i32 0
248 ; Test v4f32 insertion of 0 into the last element.
249 define <4 x float> @f28(<4 x float> %val) {
251 ; CHECK: vleif %v24, 0, 3
253 %ret = insertelement <4 x float> %val, float 0.0, i32 3
257 ; Test v4f32 insertion of a nonzero value.
258 define <4 x float> @f29(<4 x float> %val) {
262 %ret = insertelement <4 x float> %val, float 1.0, i32 1
266 ; Test v2f64 insertion of 0 into the first element.
267 define <2 x double> @f30(<2 x double> %val) {
269 ; CHECK: vleig %v24, 0, 0
271 %ret = insertelement <2 x double> %val, double 0.0, i32 0
272 ret <2 x double> %ret
275 ; Test v2f64 insertion of 0 into the last element.
276 define <2 x double> @f31(<2 x double> %val) {
278 ; CHECK: vleig %v24, 0, 1
280 %ret = insertelement <2 x double> %val, double 0.0, i32 1
281 ret <2 x double> %ret
284 ; Test v2f64 insertion of a nonzero value.
285 define <2 x double> @f32(<2 x double> %val) {
289 %ret = insertelement <2 x double> %val, double 1.0, i32 1
290 ret <2 x double> %ret