vec-move-05.ll
6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
; Test vector extraction.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
; Test v16i8 extraction of the first element.
define i8 @f1(<16 x i8> %val) {
; CHECK-LABEL: f1:
; CHECK: vlgvb %r2, %v24, 0
; CHECK: br %r14
%ret = extractelement <16 x i8> %val, i32 0
ret i8 %ret
}
; Test v16i8 extraction of the last element.
define i8 @f2(<16 x i8> %val) {
; CHECK-LABEL: f2:
; CHECK: vlgvb %r2, %v24, 15
; CHECK: br %r14
%ret = extractelement <16 x i8> %val, i32 15
ret i8 %ret
}
; Test v16i8 extractions of an absurd element number. This must compile
; but we don't care what it does.
define i8 @f3(<16 x i8> %val) {
; CHECK-LABEL: f3:
; CHECK-NOT: vlgvb %r2, %v24, 100000
; CHECK: br %r14
%ret = extractelement <16 x i8> %val, i32 100000
ret i8 %ret
}
; Test v16i8 extraction of a variable element.
define i8 @f4(<16 x i8> %val, i32 %index) {
; CHECK-LABEL: f4:
; CHECK: vlgvb %r2, %v24, 0(%r2)
; CHECK: br %r14
%ret = extractelement <16 x i8> %val, i32 %index
ret i8 %ret
}
; Test v8i16 extraction of the first element.
define i16 @f5(<8 x i16> %val) {
; CHECK-LABEL: f5:
; CHECK: vlgvh %r2, %v24, 0
; CHECK: br %r14
%ret = extractelement <8 x i16> %val, i32 0
ret i16 %ret
}
; Test v8i16 extraction of the last element.
define i16 @f6(<8 x i16> %val) {
; CHECK-LABEL: f6:
; CHECK: vlgvh %r2, %v24, 7
; CHECK: br %r14
%ret = extractelement <8 x i16> %val, i32 7
ret i16 %ret
}
; Test v8i16 extractions of an absurd element number. This must compile
; but we don't care what it does.
define i16 @f7(<8 x i16> %val) {
; CHECK-LABEL: f7:
; CHECK-NOT: vlgvh %r2, %v24, 100000
; CHECK: br %r14
%ret = extractelement <8 x i16> %val, i32 100000
ret i16 %ret
}
; Test v8i16 extraction of a variable element.
define i16 @f8(<8 x i16> %val, i32 %index) {
; CHECK-LABEL: f8:
; CHECK: vlgvh %r2, %v24, 0(%r2)
; CHECK: br %r14
%ret = extractelement <8 x i16> %val, i32 %index
ret i16 %ret
}
; Test v4i32 extraction of the first element.
define i32 @f9(<4 x i32> %val) {
; CHECK-LABEL: f9:
; CHECK: vlgvf %r2, %v24, 0
; CHECK: br %r14
%ret = extractelement <4 x i32> %val, i32 0
ret i32 %ret
}
; Test v4i32 extraction of the last element.
define i32 @f10(<4 x i32> %val) {
; CHECK-LABEL: f10:
; CHECK: vlgvf %r2, %v24, 3
; CHECK: br %r14
%ret = extractelement <4 x i32> %val, i32 3
ret i32 %ret
}
; Test v4i32 extractions of an absurd element number. This must compile
; but we don't care what it does.
define i32 @f11(<4 x i32> %val) {
; CHECK-LABEL: f11:
; CHECK-NOT: vlgvf %r2, %v24, 100000
; CHECK: br %r14
%ret = extractelement <4 x i32> %val, i32 100000
ret i32 %ret
}
; Test v4i32 extraction of a variable element.
define i32 @f12(<4 x i32> %val, i32 %index) {
; CHECK-LABEL: f12:
; CHECK: vlgvf %r2, %v24, 0(%r2)
; CHECK: br %r14
%ret = extractelement <4 x i32> %val, i32 %index
ret i32 %ret
}
; Test v2i64 extraction of the first element.
define i64 @f13(<2 x i64> %val) {
; CHECK-LABEL: f13:
; CHECK: vlgvg %r2, %v24, 0
; CHECK: br %r14
%ret = extractelement <2 x i64> %val, i32 0
ret i64 %ret
}
; Test v2i64 extraction of the last element.
define i64 @f14(<2 x i64> %val) {
; CHECK-LABEL: f14:
; CHECK: vlgvg %r2, %v24, 1
; CHECK: br %r14
%ret = extractelement <2 x i64> %val, i32 1
ret i64 %ret
}
; Test v2i64 extractions of an absurd element number. This must compile
; but we don't care what it does.
define i64 @f15(<2 x i64> %val) {
; CHECK-LABEL: f15:
; CHECK-NOT: vlgvg %r2, %v24, 100000
; CHECK: br %r14
%ret = extractelement <2 x i64> %val, i32 100000
ret i64 %ret
}
; Test v2i64 extraction of a variable element.
define i64 @f16(<2 x i64> %val, i32 %index) {
; CHECK-LABEL: f16:
; CHECK: vlgvg %r2, %v24, 0(%r2)
; CHECK: br %r14
%ret = extractelement <2 x i64> %val, i32 %index
ret i64 %ret
}
; Test v4f32 extraction of element 0.
define float @f17(<4 x float> %val) {
; CHECK-LABEL: f17:
; CHECK: vlr %v0, %v24
; CHECK: br %r14
%ret = extractelement <4 x float> %val, i32 0
ret float %ret
}
; Test v4f32 extraction of element 1.
define float @f18(<4 x float> %val) {
; CHECK-LABEL: f18:
; CHECK: vrepf %v0, %v24, 1
; CHECK: br %r14
%ret = extractelement <4 x float> %val, i32 1
ret float %ret
}
; Test v4f32 extraction of element 2.
define float @f19(<4 x float> %val) {
; CHECK-LABEL: f19:
; CHECK: vrepf %v0, %v24, 2
; CHECK: br %r14
%ret = extractelement <4 x float> %val, i32 2
ret float %ret
}
; Test v4f32 extraction of element 3.
define float @f20(<4 x float> %val) {
; CHECK-LABEL: f20:
; CHECK: vrepf %v0, %v24, 3
; CHECK: br %r14
%ret = extractelement <4 x float> %val, i32 3
ret float %ret
}
; Test v4f32 extractions of an absurd element number. This must compile
; but we don't care what it does.
define float @f21(<4 x float> %val) {
%ret = extractelement <4 x float> %val, i32 100000
ret float %ret
}
; Test v4f32 extraction of a variable element.
define float @f22(<4 x float> %val, i32 %index) {
; CHECK-LABEL: f22:
; CHECK: vlgvf [[REG:%r[0-5]]], %v24, 0(%r2)
; CHECK: vlvgf %v0, [[REG]], 0
; CHECK: br %r14
%ret = extractelement <4 x float> %val, i32 %index
ret float %ret
}
; Test v2f64 extraction of the first element.
define double @f23(<2 x double> %val) {
; CHECK-LABEL: f23:
; CHECK: vlr %v0, %v24
; CHECK: br %r14
%ret = extractelement <2 x double> %val, i32 0
ret double %ret
}
; Test v2f64 extraction of the last element.
define double @f24(<2 x double> %val) {
; CHECK-LABEL: f24:
; CHECK: vrepg %v0, %v24, 1
; CHECK: br %r14
%ret = extractelement <2 x double> %val, i32 1
ret double %ret
}
; Test v2f64 extractions of an absurd element number. This must compile
; but we don't care what it does.
define double @f25(<2 x double> %val) {
%ret = extractelement <2 x double> %val, i32 100000
ret double %ret
}
; Test v2f64 extraction of a variable element.
define double @f26(<2 x double> %val, i32 %index) {
; CHECK-LABEL: f26:
; CHECK: vlgvg [[REG:%r[0-5]]], %v24, 0(%r2)
; CHECK: ldgr %f0, [[REG]]
; CHECK: br %r14
%ret = extractelement <2 x double> %val, i32 %index
ret double %ret
}
; Test v16i8 extraction of a variable element with an offset.
define i8 @f27(<16 x i8> %val, i32 %index) {
; CHECK-LABEL: f27:
; CHECK: vlgvb %r2, %v24, 1(%r2)
; CHECK: br %r14
%add = add i32 %index, 1
%ret = extractelement <16 x i8> %val, i32 %add
ret i8 %ret
}