1 ! RUN: %flang_fc1 -flang-experimental-hlfir -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR","LLVMIR-LE" %s
2 ! RUN: %flang_fc1 -flang-experimental-hlfir -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR","LLVMIR-BE" %s
3 ! REQUIRES: target=powerpc{{.*}}
9 ! CHECK-LABEL: vec_splat_testi8i8
10 subroutine vec_splat_testi8i8(x
)
11 vector(integer(1)) :: x
, y
14 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
15 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 0
16 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 15
17 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
18 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
19 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
20 end subroutine vec_splat_testi8i8
22 ! CHECK-LABEL: vec_splat_testi8i16
23 subroutine vec_splat_testi8i16(x
)
24 vector(integer(1)) :: x
, y
27 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
28 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 0
29 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 15
30 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
31 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
32 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
33 end subroutine vec_splat_testi8i16
35 ! CHECK-LABEL: vec_splat_testi8i32
36 subroutine vec_splat_testi8i32(x
)
37 vector(integer(1)) :: x
, y
40 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
41 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 0
42 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 15
43 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
44 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
45 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
46 end subroutine vec_splat_testi8i32
48 ! CHECK-LABEL: vec_splat_testi8i64
49 subroutine vec_splat_testi8i64(x
)
50 vector(integer(1)) :: x
, y
53 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
54 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 0
55 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 15
56 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
57 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
58 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
59 end subroutine vec_splat_testi8i64
61 ! CHECK-LABEL: vec_splat_testi16i8
62 subroutine vec_splat_testi16i8(x
)
63 vector(integer(2)) :: x
, y
66 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
67 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 0
68 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 7
69 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
70 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
71 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
72 end subroutine vec_splat_testi16i8
74 ! CHECK-LABEL: vec_splat_testi16i16
75 subroutine vec_splat_testi16i16(x
)
76 vector(integer(2)) :: x
, y
79 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
80 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 0
81 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 7
82 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
83 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
84 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
85 end subroutine vec_splat_testi16i16
87 ! CHECK-LABEL: vec_splat_testi16i32
88 subroutine vec_splat_testi16i32(x
)
89 vector(integer(2)) :: x
, y
92 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
93 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 0
94 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 7
95 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
96 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
97 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
98 end subroutine vec_splat_testi16i32
100 ! CHECK-LABEL: vec_splat_testi16i64
101 subroutine vec_splat_testi16i64(x
)
102 vector(integer(2)) :: x
, y
103 y
= vec_splat(x
, 0_8)
105 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
106 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 0
107 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 7
108 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
109 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
110 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
111 end subroutine vec_splat_testi16i64
113 ! CHECK-LABEL: vec_splat_testi32i8
114 subroutine vec_splat_testi32i8(x
)
115 vector(integer(4)) :: x
, y
116 y
= vec_splat(x
, 0_1)
118 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
119 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 0
120 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 3
121 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
122 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
123 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
124 end subroutine vec_splat_testi32i8
126 ! CHECK-LABEL: vec_splat_testi32i16
127 subroutine vec_splat_testi32i16(x
)
128 vector(integer(4)) :: x
, y
129 y
= vec_splat(x
, 0_2)
131 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
132 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 0
133 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 3
134 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
135 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
136 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
137 end subroutine vec_splat_testi32i16
139 ! CHECK-LABEL: vec_splat_testi32i32
140 subroutine vec_splat_testi32i32(x
)
141 vector(integer(4)) :: x
, y
142 y
= vec_splat(x
, 0_4)
144 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
145 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 0
146 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 3
147 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
148 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
149 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
150 end subroutine vec_splat_testi32i32
152 ! CHECK-LABEL: vec_splat_testi32i64
153 subroutine vec_splat_testi32i64(x
)
154 vector(integer(4)) :: x
, y
155 y
= vec_splat(x
, 0_8)
157 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
158 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 0
159 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 3
160 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
161 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
162 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
163 end subroutine vec_splat_testi32i64
165 ! CHECK-LABEL: vec_splat_testi64i8
166 subroutine vec_splat_testi64i8(x
)
167 vector(integer(8)) :: x
, y
168 y
= vec_splat(x
, 0_1)
170 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
171 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 0
172 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 1
173 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
174 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
175 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
176 end subroutine vec_splat_testi64i8
178 ! CHECK-LABEL: vec_splat_testi64i16
179 subroutine vec_splat_testi64i16(x
)
180 vector(integer(8)) :: x
, y
181 y
= vec_splat(x
, 0_2)
183 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
184 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 0
185 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 1
186 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
187 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
188 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
189 end subroutine vec_splat_testi64i16
191 ! CHECK-LABEL: vec_splat_testi64i32
192 subroutine vec_splat_testi64i32(x
)
193 vector(integer(8)) :: x
, y
194 y
= vec_splat(x
, 0_4)
196 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
197 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 0
198 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 1
199 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
200 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
201 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
202 end subroutine vec_splat_testi64i32
204 ! CHECK-LABEL: vec_splat_testi64i64
205 subroutine vec_splat_testi64i64(x
)
206 vector(integer(8)) :: x
, y
207 y
= vec_splat(x
, 0_8)
209 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
210 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 0
211 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 1
212 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
213 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
214 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
215 end subroutine vec_splat_testi64i64
217 ! CHECK-LABEL: vec_splat_testf32i8
218 subroutine vec_splat_testf32i8(x
)
219 vector(real(4)) :: x
, y
220 y
= vec_splat(x
, 0_1)
222 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
223 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i8 0
224 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i8 3
225 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
226 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
227 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
228 end subroutine vec_splat_testf32i8
230 ! CHECK-LABEL: vec_splat_testf32i16
231 subroutine vec_splat_testf32i16(x
)
232 vector(real(4)) :: x
, y
233 y
= vec_splat(x
, 0_2)
235 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
236 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i16 0
237 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i16 3
238 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
239 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
240 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
241 end subroutine vec_splat_testf32i16
243 ! CHECK-LABEL: vec_splat_testf32i32
244 subroutine vec_splat_testf32i32(x
)
245 vector(real(4)) :: x
, y
246 y
= vec_splat(x
, 0_4)
248 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
249 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i32 0
250 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i32 3
251 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
252 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
253 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
254 end subroutine vec_splat_testf32i32
256 ! CHECK-LABEL: vec_splat_testf32i64
257 subroutine vec_splat_testf32i64(x
)
258 vector(real(4)) :: x
, y
259 y
= vec_splat(x
, 0_8)
261 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
262 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i64 0
263 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x float> %[[x]], i64 3
264 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
265 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
266 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
267 end subroutine vec_splat_testf32i64
269 ! CHECK-LABEL: vec_splat_testf64i8
270 subroutine vec_splat_testf64i8(x
)
271 vector(real(8)) :: x
, y
272 y
= vec_splat(x
, 0_1)
274 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
275 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i8 0
276 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i8 1
277 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
278 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
279 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
280 end subroutine vec_splat_testf64i8
282 ! CHECK-LABEL: vec_splat_testf64i16
283 subroutine vec_splat_testf64i16(x
)
284 vector(real(8)) :: x
, y
285 y
= vec_splat(x
, 0_2)
287 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
288 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i16 0
289 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i16 1
290 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
291 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
292 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
293 end subroutine vec_splat_testf64i16
295 ! CHECK-LABEL: vec_splat_testf64i32
296 subroutine vec_splat_testf64i32(x
)
297 vector(real(8)) :: x
, y
298 y
= vec_splat(x
, 0_4)
300 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
301 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i32 0
302 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i32 1
303 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
304 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
305 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
306 end subroutine vec_splat_testf64i32
308 ! CHECK-LABEL: vec_splat_testf64i64
309 subroutine vec_splat_testf64i64(x
)
310 vector(real(8)) :: x
, y
311 y
= vec_splat(x
, 0_8)
313 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
314 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i64 0
315 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x double> %[[x]], i64 1
316 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
317 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
318 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
319 end subroutine vec_splat_testf64i64
321 ! CHECK-LABEL: vec_splat_testu8i8
322 subroutine vec_splat_testu8i8(x
)
323 vector(unsigned(1)) :: x
, y
324 y
= vec_splat(x
, 0_1)
326 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
327 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 0
328 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 15
329 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
330 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
331 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
332 end subroutine vec_splat_testu8i8
334 ! CHECK-LABEL: vec_splat_testu8i16
335 subroutine vec_splat_testu8i16(x
)
336 vector(unsigned(1)) :: x
, y
337 y
= vec_splat(x
, 0_2)
339 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
340 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 0
341 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 15
342 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
343 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
344 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
345 end subroutine vec_splat_testu8i16
347 ! CHECK-LABEL: vec_splat_testu8i32
348 subroutine vec_splat_testu8i32(x
)
349 vector(unsigned(1)) :: x
, y
350 y
= vec_splat(x
, 0_4)
352 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
353 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 0
354 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 15
355 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
356 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
357 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
358 end subroutine vec_splat_testu8i32
360 ! CHECK-LABEL: vec_splat_testu8i64
361 subroutine vec_splat_testu8i64(x
)
362 vector(unsigned(1)) :: x
, y
363 y
= vec_splat(x
, 0_8)
365 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
366 ! LLVMIR-LE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 0
367 ! LLVMIR-BE: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 15
368 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
369 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
370 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
371 end subroutine vec_splat_testu8i64
373 ! CHECK-LABEL: vec_splat_testu16i8
374 subroutine vec_splat_testu16i8(x
)
375 vector(unsigned(2)) :: x
, y
376 y
= vec_splat(x
, 0_1)
378 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
379 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 0
380 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 7
381 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
382 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
383 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
384 end subroutine vec_splat_testu16i8
386 ! CHECK-LABEL: vec_splat_testu16i16
387 subroutine vec_splat_testu16i16(x
)
388 vector(unsigned(2)) :: x
, y
389 y
= vec_splat(x
, 0_2)
391 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
392 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 0
393 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 7
394 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
395 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
396 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
397 end subroutine vec_splat_testu16i16
399 ! CHECK-LABEL: vec_splat_testu16i32
400 subroutine vec_splat_testu16i32(x
)
401 vector(unsigned(2)) :: x
, y
402 y
= vec_splat(x
, 0_4)
404 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
405 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 0
406 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 7
407 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
408 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
409 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
410 end subroutine vec_splat_testu16i32
412 ! CHECK-LABEL: vec_splat_testu16i64
413 subroutine vec_splat_testu16i64(x
)
414 vector(unsigned(2)) :: x
, y
415 y
= vec_splat(x
, 0_8)
417 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
418 ! LLVMIR-LE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 0
419 ! LLVMIR-BE: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 7
420 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
421 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
422 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
423 end subroutine vec_splat_testu16i64
425 ! CHECK-LABEL: vec_splat_testu32i8
426 subroutine vec_splat_testu32i8(x
)
427 vector(unsigned(4)) :: x
, y
428 y
= vec_splat(x
, 0_1)
430 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
431 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 0
432 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 3
433 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
434 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
435 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
436 end subroutine vec_splat_testu32i8
438 ! CHECK-LABEL: vec_splat_testu32i16
439 subroutine vec_splat_testu32i16(x
)
440 vector(unsigned(4)) :: x
, y
441 y
= vec_splat(x
, 0_2)
443 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
444 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 0
445 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 3
446 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
447 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
448 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
449 end subroutine vec_splat_testu32i16
451 ! CHECK-LABEL: vec_splat_testu32i32
452 subroutine vec_splat_testu32i32(x
)
453 vector(unsigned(4)) :: x
, y
454 y
= vec_splat(x
, 0_4)
456 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
457 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 0
458 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 3
459 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
460 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
461 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
462 end subroutine vec_splat_testu32i32
464 ! CHECK-LABEL: vec_splat_testu32i64
465 subroutine vec_splat_testu32i64(x
)
466 vector(unsigned(4)) :: x
, y
467 y
= vec_splat(x
, 0_8)
469 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
470 ! LLVMIR-LE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 0
471 ! LLVMIR-BE: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 3
472 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
473 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
474 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
475 end subroutine vec_splat_testu32i64
477 ! CHECK-LABEL: vec_splat_testu64i8
478 subroutine vec_splat_testu64i8(x
)
479 vector(unsigned(8)) :: x
, y
480 y
= vec_splat(x
, 0_1)
482 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
483 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 0
484 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 1
485 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
486 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
487 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
488 end subroutine vec_splat_testu64i8
490 ! CHECK-LABEL: vec_splat_testu64i16
491 subroutine vec_splat_testu64i16(x
)
492 vector(unsigned(8)) :: x
, y
493 y
= vec_splat(x
, 0_2)
495 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
496 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 0
497 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 1
498 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
499 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
500 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
501 end subroutine vec_splat_testu64i16
503 ! CHECK-LABEL: vec_splat_testu64i32
504 subroutine vec_splat_testu64i32(x
)
505 vector(unsigned(8)) :: x
, y
506 y
= vec_splat(x
, 0_4)
508 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
509 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 0
510 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 1
511 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
512 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
513 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
514 end subroutine vec_splat_testu64i32
516 ! CHECK-LABEL: vec_splat_testu64i64
517 subroutine vec_splat_testu64i64(x
)
518 vector(unsigned(8)) :: x
, y
519 y
= vec_splat(x
, 0_8)
521 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
522 ! LLVMIR-LE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 0
523 ! LLVMIR-BE: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 1
524 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
525 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
526 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
527 end subroutine vec_splat_testu64i64
533 ! CHECK-LABEL: vec_splats_testi8
534 subroutine vec_splats_testi8(x
)
536 vector(integer(1)) :: y
539 ! LLVMIR: %[[x:.*]] = load i8, ptr %{{[0-9]}}, align 1
540 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[x]], i32 0
541 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
542 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
543 end subroutine vec_splats_testi8
545 ! CHECK-LABEL: vec_splats_testi16
546 subroutine vec_splats_testi16(x
)
548 vector(integer(2)) :: y
551 ! LLVMIR: %[[x:.*]] = load i16, ptr %{{[0-9]}}, align 2
552 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[x]], i32 0
553 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
554 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
555 end subroutine vec_splats_testi16
557 ! CHECK-LABEL: vec_splats_testi32
558 subroutine vec_splats_testi32(x
)
560 vector(integer(4)) :: y
563 ! LLVMIR: %[[x:.*]] = load i32, ptr %{{[0-9]}}, align 4
564 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[x]], i32 0
565 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
566 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
567 end subroutine vec_splats_testi32
569 ! CHECK-LABEL: vec_splats_testi64
570 subroutine vec_splats_testi64(x
)
572 vector(integer(8)) :: y
575 ! LLVMIR: %[[x:.*]] = load i64, ptr %{{[0-9]}}, align 8
576 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[x]], i32 0
577 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
578 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
579 end subroutine vec_splats_testi64
581 ! CHECK-LABEL: vec_splats_testf32
582 subroutine vec_splats_testf32(x
)
587 ! LLVMIR: %[[x:.*]] = load float, ptr %{{[0-9]}}, align 4
588 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[x]], i32 0
589 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
590 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
591 end subroutine vec_splats_testf32
593 ! CHECK-LABEL: vec_splats_testf64
594 subroutine vec_splats_testf64(x
)
599 ! LLVMIR: %[[x:.*]] = load double, ptr %{{[0-9]}}, align 8
600 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[x]], i32 0
601 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
602 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
603 end subroutine vec_splats_testf64
605 ! CHECK-LABEL: vec_splat_s32testi8
606 subroutine vec_splat_s32testi8()
607 vector(integer(4)) :: y
608 y
= vec_splat_s32(7_1)
610 ! LLVMIR: store <4 x i32> splat (i32 7), ptr %{{[0-9]}}, align 16
611 end subroutine vec_splat_s32testi8
613 ! CHECK-LABEL: vec_splat_s32testi16
614 subroutine vec_splat_s32testi16()
615 vector(integer(4)) :: y
616 y
= vec_splat_s32(7_2)
618 ! LLVMIR: store <4 x i32> splat (i32 7), ptr %{{[0-9]}}, align 16
619 end subroutine vec_splat_s32testi16
621 ! CHECK-LABEL: vec_splat_s32testi32
622 subroutine vec_splat_s32testi32()
623 vector(integer(4)) :: y
624 y
= vec_splat_s32(7_4)
626 ! LLVMIR: store <4 x i32> splat (i32 7), ptr %{{[0-9]}}, align 16
627 end subroutine vec_splat_s32testi32
629 ! CHECK-LABEL: vec_splat_s32testi64
630 subroutine vec_splat_s32testi64()
631 vector(integer(4)) :: y
632 y
= vec_splat_s32(7_8)
634 ! LLVMIR: store <4 x i32> splat (i32 7), ptr %{{[0-9]}}, align 16
635 end subroutine vec_splat_s32testi64