1; Test insertions of memory values into 0.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; Test VLLEZB.
6define <16 x i8> @f1(i8 *%ptr) {
7; CHECK-LABEL: f1:
8; CHECK: vllezb %v24, 0(%r2)
9; CHECK: br %r14
10  %val = load i8, i8 *%ptr
11  %ret = insertelement <16 x i8> zeroinitializer, i8 %val, i32 7
12  ret <16 x i8> %ret
13}
14
15; Test VLLEZB with the highest in-range offset.
16define <16 x i8> @f2(i8 *%base) {
17; CHECK-LABEL: f2:
18; CHECK: vllezb %v24, 4095(%r2)
19; CHECK: br %r14
20  %ptr = getelementptr i8, i8 *%base, i64 4095
21  %val = load i8, i8 *%ptr
22  %ret = insertelement <16 x i8> zeroinitializer, i8 %val, i32 7
23  ret <16 x i8> %ret
24}
25
26; Test VLLEZB with the next highest offset.
27define <16 x i8> @f3(i8 *%base) {
28; CHECK-LABEL: f3:
29; CHECK-NOT: vllezb %v24, 4096(%r2)
30; CHECK: br %r14
31  %ptr = getelementptr i8, i8 *%base, i64 4096
32  %val = load i8, i8 *%ptr
33  %ret = insertelement <16 x i8> zeroinitializer, i8 %val, i32 7
34  ret <16 x i8> %ret
35}
36
37; Test that VLLEZB allows an index.
38define <16 x i8> @f4(i8 *%base, i64 %index) {
39; CHECK-LABEL: f4:
40; CHECK: vllezb %v24, 0({{%r2,%r3|%r3,%r2}})
41; CHECK: br %r14
42  %ptr = getelementptr i8, i8 *%base, i64 %index
43  %val = load i8, i8 *%ptr
44  %ret = insertelement <16 x i8> zeroinitializer, i8 %val, i32 7
45  ret <16 x i8> %ret
46}
47
48; Test VLLEZH.
49define <8 x i16> @f5(i16 *%ptr) {
50; CHECK-LABEL: f5:
51; CHECK: vllezh %v24, 0(%r2)
52; CHECK: br %r14
53  %val = load i16, i16 *%ptr
54  %ret = insertelement <8 x i16> zeroinitializer, i16 %val, i32 3
55  ret <8 x i16> %ret
56}
57
58; Test VLLEZF.
59define <4 x i32> @f6(i32 *%ptr) {
60; CHECK-LABEL: f6:
61; CHECK: vllezf %v24, 0(%r2)
62; CHECK: br %r14
63  %val = load i32, i32 *%ptr
64  %ret = insertelement <4 x i32> zeroinitializer, i32 %val, i32 1
65  ret <4 x i32> %ret
66}
67
68; Test VLLEZG.
69define <2 x i64> @f7(i64 *%ptr) {
70; CHECK-LABEL: f7:
71; CHECK: vllezg %v24, 0(%r2)
72; CHECK: br %r14
73  %val = load i64, i64 *%ptr
74  %ret = insertelement <2 x i64> zeroinitializer, i64 %val, i32 0
75  ret <2 x i64> %ret
76}
77
78; Test VLLEZF with a float.
79define <4 x float> @f8(float *%ptr) {
80; CHECK-LABEL: f8:
81; CHECK: vllezf %v24, 0(%r2)
82; CHECK: br %r14
83  %val = load float, float *%ptr
84  %ret = insertelement <4 x float> zeroinitializer, float %val, i32 1
85  ret <4 x float> %ret
86}
87
88; Test VLLEZG with a double.
89define <2 x double> @f9(double *%ptr) {
90; CHECK-LABEL: f9:
91; CHECK: vllezg %v24, 0(%r2)
92; CHECK: br %r14
93  %val = load double, double *%ptr
94  %ret = insertelement <2 x double> zeroinitializer, double %val, i32 0
95  ret <2 x double> %ret
96}
97
98; Test VLLEZF with a float when the result is stored to memory.
99define void @f10(float *%ptr, <4 x float> *%res) {
100; CHECK-LABEL: f10:
101; CHECK: vllezf [[REG:%v[0-9]+]], 0(%r2)
102; CHECK: vst [[REG]], 0(%r3)
103; CHECK: br %r14
104  %val = load float, float *%ptr
105  %ret = insertelement <4 x float> zeroinitializer, float %val, i32 1
106  store <4 x float> %ret, <4 x float> *%res
107  ret void
108}
109
110; Test VLLEZG with a double when the result is stored to memory.
111define void @f11(double *%ptr, <2 x double> *%res) {
112; CHECK-LABEL: f11:
113; CHECK: vllezg [[REG:%v[0-9]+]], 0(%r2)
114; CHECK: vst [[REG]], 0(%r3)
115; CHECK: br %r14
116  %val = load double, double *%ptr
117  %ret = insertelement <2 x double> zeroinitializer, double %val, i32 0
118  store <2 x double> %ret, <2 x double> *%res
119  ret void
120}
121
122; Test VLLEZG when the zeroinitializer is shared.
123define void @f12(i64 *%ptr, <2 x i64> *%res) {
124; CHECK-LABEL: f12:
125; CHECK: vllezg [[REG:%v[0-9]+]], 0(%r2)
126; CHECK: vst [[REG]], 0(%r3)
127; CHECK: vllezg [[REG1:%v[0-9]+]], 0(%r2)
128; CHECK: vst [[REG1]], 0(%r3)
129; CHECK: br %r14
130  %val = load volatile i64, i64 *%ptr
131  %ret = insertelement <2 x i64> zeroinitializer, i64 %val, i32 0
132  store volatile <2 x i64> %ret, <2 x i64> *%res
133  %val1 = load volatile i64, i64 *%ptr
134  %ret1 = insertelement <2 x i64> zeroinitializer, i64 %val1, i32 0
135  store volatile <2 x i64> %ret1, <2 x i64> *%res
136  ret void
137}
138
139