1 ; Test vector insertion of register variables.
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, i8 %element) {
8 ; CHECK: vlvgb %v24, %r2, 0
10 %ret = insertelement <16 x i8> %val, i8 %element, i32 0
14 ; Test v16i8 insertion into the last element.
15 define <16 x i8> @f2(<16 x i8> %val, i8 %element) {
17 ; CHECK: vlvgb %v24, %r2, 15
19 %ret = insertelement <16 x i8> %val, i8 %element, i32 15
23 ; Test v16i8 insertion into a variable element.
24 define <16 x i8> @f3(<16 x i8> %val, i8 %element, i32 %index) {
26 ; CHECK: vlvgb %v24, %r2, 0(%r3)
28 %ret = insertelement <16 x i8> %val, i8 %element, i32 %index
32 ; Test v8i16 insertion into the first element.
33 define <8 x i16> @f4(<8 x i16> %val, i16 %element) {
35 ; CHECK: vlvgh %v24, %r2, 0
37 %ret = insertelement <8 x i16> %val, i16 %element, i32 0
41 ; Test v8i16 insertion into the last element.
42 define <8 x i16> @f5(<8 x i16> %val, i16 %element) {
44 ; CHECK: vlvgh %v24, %r2, 7
46 %ret = insertelement <8 x i16> %val, i16 %element, i32 7
50 ; Test v8i16 insertion into a variable element.
51 define <8 x i16> @f6(<8 x i16> %val, i16 %element, i32 %index) {
53 ; CHECK: vlvgh %v24, %r2, 0(%r3)
55 %ret = insertelement <8 x i16> %val, i16 %element, i32 %index
59 ; Test v4i32 insertion into the first element.
60 define <4 x i32> @f7(<4 x i32> %val, i32 %element) {
62 ; CHECK: vlvgf %v24, %r2, 0
64 %ret = insertelement <4 x i32> %val, i32 %element, i32 0
68 ; Test v4i32 insertion into the last element.
69 define <4 x i32> @f8(<4 x i32> %val, i32 %element) {
71 ; CHECK: vlvgf %v24, %r2, 3
73 %ret = insertelement <4 x i32> %val, i32 %element, i32 3
77 ; Test v4i32 insertion into a variable element.
78 define <4 x i32> @f9(<4 x i32> %val, i32 %element, i32 %index) {
80 ; CHECK: vlvgf %v24, %r2, 0(%r3)
82 %ret = insertelement <4 x i32> %val, i32 %element, i32 %index
86 ; Test v2i64 insertion into the first element.
87 define <2 x i64> @f10(<2 x i64> %val, i64 %element) {
89 ; CHECK: vlvgg %v24, %r2, 0
91 %ret = insertelement <2 x i64> %val, i64 %element, i32 0
95 ; Test v2i64 insertion into the last element.
96 define <2 x i64> @f11(<2 x i64> %val, i64 %element) {
98 ; CHECK: vlvgg %v24, %r2, 1
100 %ret = insertelement <2 x i64> %val, i64 %element, i32 1
104 ; Test v2i64 insertion into a variable element.
105 define <2 x i64> @f12(<2 x i64> %val, i64 %element, i32 %index) {
107 ; CHECK: vlvgg %v24, %r2, 0(%r3)
109 %ret = insertelement <2 x i64> %val, i64 %element, i32 %index
113 ; Test v4f32 insertion into the first element.
114 define <4 x float> @f13(<4 x float> %val, float %element) {
116 ; CHECK: vlgvf [[REG:%r[0-5]]], %v0, 0
117 ; CHECK: vlvgf %v24, [[REG]], 0
119 %ret = insertelement <4 x float> %val, float %element, i32 0
123 ; Test v4f32 insertion into the last element.
124 define <4 x float> @f14(<4 x float> %val, float %element) {
126 ; CHECK: vlgvf [[REG:%r[0-5]]], %v0, 0
127 ; CHECK: vlvgf %v24, [[REG]], 3
129 %ret = insertelement <4 x float> %val, float %element, i32 3
133 ; Test v4f32 insertion into a variable element.
134 define <4 x float> @f15(<4 x float> %val, float %element, i32 %index) {
136 ; CHECK: vlgvf [[REG:%r[0-5]]], %v0, 0
137 ; CHECK: vlvgf %v24, [[REG]], 0(%r2)
139 %ret = insertelement <4 x float> %val, float %element, i32 %index
143 ; Test v2f64 insertion into the first element.
144 define <2 x double> @f16(<2 x double> %val, double %element) {
146 ; CHECK: vpdi %v24, %v0, %v24, 1
148 %ret = insertelement <2 x double> %val, double %element, i32 0
149 ret <2 x double> %ret
152 ; Test v2f64 insertion into the last element.
153 define <2 x double> @f17(<2 x double> %val, double %element) {
155 ; CHECK: vpdi %v24, %v24, %v0, 0
157 %ret = insertelement <2 x double> %val, double %element, i32 1
158 ret <2 x double> %ret
161 ; Test v2f64 insertion into a variable element.
162 define <2 x double> @f18(<2 x double> %val, double %element, i32 %index) {
164 ; CHECK: lgdr [[REG:%r[0-5]]], %f0
165 ; CHECK: vlvgg %v24, [[REG]], 0(%r2)
167 %ret = insertelement <2 x double> %val, double %element, i32 %index
168 ret <2 x double> %ret
171 ; Test v16i8 insertion into a variable element plus one.
172 define <16 x i8> @f19(<16 x i8> %val, i8 %element, i32 %index) {
174 ; CHECK: vlvgb %v24, %r2, 1(%r3)
176 %add = add i32 %index, 1
177 %ret = insertelement <16 x i8> %val, i8 %element, i32 %add