1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve < %s | FileCheck %s
4 define <vscale x 16 x i8> @sel_8_positive(<vscale x 16 x i1> %p) {
5 ; CHECK-LABEL: sel_8_positive:
7 ; CHECK-NEXT: mov z0.b, p0/z, #3 // =0x3
9 %vec = shufflevector <vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 3, i32 0), <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i32> zeroinitializer
10 %sel = select <vscale x 16 x i1> %p, <vscale x 16 x i8> %vec, <vscale x 16 x i8> zeroinitializer
11 ret <vscale x 16 x i8> %sel
14 define <vscale x 8 x i16> @sel_16_positive(<vscale x 8 x i1> %p) {
15 ; CHECK-LABEL: sel_16_positive:
17 ; CHECK-NEXT: mov z0.h, p0/z, #3 // =0x3
19 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 3, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
20 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> zeroinitializer
21 ret <vscale x 8 x i16> %sel
24 define <vscale x 4 x i32> @sel_32_positive(<vscale x 4 x i1> %p) {
25 ; CHECK-LABEL: sel_32_positive:
27 ; CHECK-NEXT: mov z0.s, p0/z, #3 // =0x3
29 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
30 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> zeroinitializer
31 ret <vscale x 4 x i32> %sel
34 define <vscale x 2 x i64> @sel_64_positive(<vscale x 2 x i1> %p) {
35 ; CHECK-LABEL: sel_64_positive:
37 ; CHECK-NEXT: mov z0.d, p0/z, #3 // =0x3
39 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 3, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
40 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> zeroinitializer
41 ret <vscale x 2 x i64> %sel
44 define <vscale x 16 x i8> @sel_8_negative(<vscale x 16 x i1> %p) {
45 ; CHECK-LABEL: sel_8_negative:
47 ; CHECK-NEXT: mov z0.b, p0/z, #-128 // =0xffffffffffffff80
49 %vec = shufflevector <vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 -128, i32 0), <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i32> zeroinitializer
50 %sel = select <vscale x 16 x i1> %p, <vscale x 16 x i8> %vec, <vscale x 16 x i8> zeroinitializer
51 ret <vscale x 16 x i8> %sel
54 define <vscale x 8 x i16> @sel_16_negative(<vscale x 8 x i1> %p) {
55 ; CHECK-LABEL: sel_16_negative:
57 ; CHECK-NEXT: mov z0.h, p0/z, #-128 // =0xffffffffffffff80
59 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 -128, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
60 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> zeroinitializer
61 ret <vscale x 8 x i16> %sel
64 define <vscale x 4 x i32> @sel_32_negative(<vscale x 4 x i1> %p) {
65 ; CHECK-LABEL: sel_32_negative:
67 ; CHECK-NEXT: mov z0.s, p0/z, #-128 // =0xffffffffffffff80
69 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 -128, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
70 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> zeroinitializer
71 ret <vscale x 4 x i32> %sel
74 define <vscale x 2 x i64> @sel_64_negative(<vscale x 2 x i1> %p) {
75 ; CHECK-LABEL: sel_64_negative:
77 ; CHECK-NEXT: mov z0.d, p0/z, #-128 // =0xffffffffffffff80
79 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 -128, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
80 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> zeroinitializer
81 ret <vscale x 2 x i64> %sel
84 define <vscale x 8 x i16> @sel_16_shifted(<vscale x 8 x i1> %p) {
85 ; CHECK-LABEL: sel_16_shifted:
87 ; CHECK-NEXT: mov z0.h, p0/z, #512 // =0x200
89 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 512, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
90 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> zeroinitializer
91 ret <vscale x 8 x i16> %sel
94 define <vscale x 4 x i32> @sel_32_shifted(<vscale x 4 x i1> %p) {
95 ; CHECK-LABEL: sel_32_shifted:
97 ; CHECK-NEXT: mov z0.s, p0/z, #512 // =0x200
99 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 512, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
100 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> zeroinitializer
101 ret <vscale x 4 x i32> %sel
104 define <vscale x 2 x i64> @sel_64_shifted(<vscale x 2 x i1> %p) {
105 ; CHECK-LABEL: sel_64_shifted:
107 ; CHECK-NEXT: mov z0.d, p0/z, #512 // =0x200
109 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 512, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
110 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> zeroinitializer
111 ret <vscale x 2 x i64> %sel
114 ; TODO: We could actually use something like "cpy z0.b, p0/z, #-128". But it's
115 ; a little tricky to prove correctness: we're using the predicate with the
116 ; wrong width, so we'd have to prove the bits which would normally be unused
118 define <vscale x 8 x i16> @sel_16_illegal_wrong_extension(<vscale x 8 x i1> %p) {
119 ; CHECK-LABEL: sel_16_illegal_wrong_extension:
121 ; CHECK-NEXT: mov z0.h, #128 // =0x80
122 ; CHECK-NEXT: mov z1.h, #0 // =0x0
123 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
125 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 128, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
126 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> zeroinitializer
127 ret <vscale x 8 x i16> %sel
130 define <vscale x 4 x i32> @sel_32_illegal_wrong_extension(<vscale x 4 x i1> %p) {
131 ; CHECK-LABEL: sel_32_illegal_wrong_extension:
133 ; CHECK-NEXT: mov z0.s, #128 // =0x80
134 ; CHECK-NEXT: mov z1.s, #0 // =0x0
135 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
137 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 128, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
138 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> zeroinitializer
139 ret <vscale x 4 x i32> %sel
142 define <vscale x 2 x i64> @sel_64_illegal_wrong_extension(<vscale x 2 x i1> %p) {
143 ; CHECK-LABEL: sel_64_illegal_wrong_extension:
145 ; CHECK-NEXT: mov z0.d, #128 // =0x80
146 ; CHECK-NEXT: mov z1.d, #0 // =0x0
147 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
149 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 128, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
150 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> zeroinitializer
151 ret <vscale x 2 x i64> %sel
154 define <vscale x 8 x i16> @sel_16_illegal_shifted(<vscale x 8 x i1> %p) {
155 ; CHECK-LABEL: sel_16_illegal_shifted:
157 ; CHECK-NEXT: mov w8, #513 // =0x201
158 ; CHECK-NEXT: mov z1.h, #0 // =0x0
159 ; CHECK-NEXT: mov z0.h, w8
160 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
162 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 513, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
163 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> zeroinitializer
164 ret <vscale x 8 x i16> %sel
167 define <vscale x 4 x i32> @sel_32_illegal_shifted(<vscale x 4 x i1> %p) {
168 ; CHECK-LABEL: sel_32_illegal_shifted:
170 ; CHECK-NEXT: mov w8, #513 // =0x201
171 ; CHECK-NEXT: mov z1.s, #0 // =0x0
172 ; CHECK-NEXT: mov z0.s, w8
173 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
175 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 513, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
176 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> zeroinitializer
177 ret <vscale x 4 x i32> %sel
180 define <vscale x 2 x i64> @sel_64_illegal_shifted(<vscale x 2 x i1> %p) {
181 ; CHECK-LABEL: sel_64_illegal_shifted:
183 ; CHECK-NEXT: mov w8, #513 // =0x201
184 ; CHECK-NEXT: mov z1.d, #0 // =0x0
185 ; CHECK-NEXT: mov z0.d, x8
186 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
188 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 513, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
189 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> zeroinitializer
190 ret <vscale x 2 x i64> %sel
193 define <vscale x 16 x i8> @sel_merge_8_positive(<vscale x 16 x i1> %p, <vscale x 16 x i8> %in) {
194 ; CHECK-LABEL: sel_merge_8_positive:
196 ; CHECK-NEXT: mov z0.b, p0/m, #3 // =0x3
198 %vec = shufflevector <vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 3, i32 0), <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i32> zeroinitializer
199 %sel = select <vscale x 16 x i1> %p, <vscale x 16 x i8> %vec, <vscale x 16 x i8> %in
200 ret <vscale x 16 x i8> %sel
203 define <vscale x 8 x i16> @sel_merge_16_positive(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
204 ; CHECK-LABEL: sel_merge_16_positive:
206 ; CHECK-NEXT: mov z0.h, p0/m, #3 // =0x3
208 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 3, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
209 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> %in
210 ret <vscale x 8 x i16> %sel
213 define <vscale x 4 x i32> @sel_merge_32_positive(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
214 ; CHECK-LABEL: sel_merge_32_positive:
216 ; CHECK-NEXT: mov z0.s, p0/m, #3 // =0x3
218 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
219 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> %in
220 ret <vscale x 4 x i32> %sel
223 define <vscale x 2 x i64> @sel_merge_64_positive(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
224 ; CHECK-LABEL: sel_merge_64_positive:
226 ; CHECK-NEXT: mov z0.d, p0/m, #3 // =0x3
228 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 3, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
229 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> %in
230 ret <vscale x 2 x i64> %sel
233 define <vscale x 16 x i8> @sel_merge_8_negative(<vscale x 16 x i1> %p, <vscale x 16 x i8> %in) {
234 ; CHECK-LABEL: sel_merge_8_negative:
236 ; CHECK-NEXT: mov z0.b, p0/m, #-128 // =0xffffffffffffff80
238 %vec = shufflevector <vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 -128, i32 0), <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i32> zeroinitializer
239 %sel = select <vscale x 16 x i1> %p, <vscale x 16 x i8> %vec, <vscale x 16 x i8> %in
240 ret <vscale x 16 x i8> %sel
243 define <vscale x 8 x i16> @sel_merge_16_negative(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
244 ; CHECK-LABEL: sel_merge_16_negative:
246 ; CHECK-NEXT: mov z0.h, p0/m, #-128 // =0xffffffffffffff80
248 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 -128, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
249 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> %in
250 ret <vscale x 8 x i16> %sel
253 define <vscale x 4 x i32> @sel_merge_32_negative(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
254 ; CHECK-LABEL: sel_merge_32_negative:
256 ; CHECK-NEXT: mov z0.s, p0/m, #-128 // =0xffffffffffffff80
258 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 -128, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
259 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> %in
260 ret <vscale x 4 x i32> %sel
263 define <vscale x 2 x i64> @sel_merge_64_negative(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
264 ; CHECK-LABEL: sel_merge_64_negative:
266 ; CHECK-NEXT: mov z0.d, p0/m, #-128 // =0xffffffffffffff80
268 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 -128, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
269 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> %in
270 ret <vscale x 2 x i64> %sel
273 define <vscale x 16 x i8> @sel_merge_8_zero(<vscale x 16 x i1> %p, <vscale x 16 x i8> %in) {
274 ; CHECK-LABEL: sel_merge_8_zero:
276 ; CHECK-NEXT: mov z0.b, p0/m, #0 // =0x0
278 %sel = select <vscale x 16 x i1> %p, <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i8> %in
279 ret <vscale x 16 x i8> %sel
282 define <vscale x 8 x i16> @sel_merge_16_zero(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
283 ; CHECK-LABEL: sel_merge_16_zero:
285 ; CHECK-NEXT: mov z0.h, p0/m, #0 // =0x0
287 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i16> %in
288 ret <vscale x 8 x i16> %sel
291 define <vscale x 4 x i32> @sel_merge_32_zero(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
292 ; CHECK-LABEL: sel_merge_32_zero:
294 ; CHECK-NEXT: mov z0.s, p0/m, #0 // =0x0
296 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> %in
297 ret <vscale x 4 x i32> %sel
300 define <vscale x 2 x i64> @sel_merge_64_zero(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
301 ; CHECK-LABEL: sel_merge_64_zero:
303 ; CHECK-NEXT: mov z0.d, p0/m, #0 // =0x0
305 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i64> %in
306 ret <vscale x 2 x i64> %sel
309 define <vscale x 8 x half> @sel_merge_nxv8f16_zero(<vscale x 8 x i1> %p, <vscale x 8 x half> %in) {
310 ; CHECK-LABEL: sel_merge_nxv8f16_zero:
312 ; CHECK-NEXT: mov z0.h, p0/m, #0 // =0x0
314 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x half> zeroinitializer, <vscale x 8 x half> %in
315 ret <vscale x 8 x half> %sel
318 define <vscale x 4 x half> @sel_merge_nx4f16_zero(<vscale x 4 x i1> %p, <vscale x 4 x half> %in) {
319 ; CHECK-LABEL: sel_merge_nx4f16_zero:
321 ; CHECK-NEXT: mov z0.s, p0/m, #0 // =0x0
323 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x half> zeroinitializer, <vscale x 4 x half> %in
324 ret <vscale x 4 x half> %sel
327 define <vscale x 2 x half> @sel_merge_nx2f16_zero(<vscale x 2 x i1> %p, <vscale x 2 x half> %in) {
328 ; CHECK-LABEL: sel_merge_nx2f16_zero:
330 ; CHECK-NEXT: mov z0.d, p0/m, #0 // =0x0
332 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x half> zeroinitializer, <vscale x 2 x half> %in
333 ret <vscale x 2 x half> %sel
336 define <vscale x 4 x float> @sel_merge_nx4f32_zero(<vscale x 4 x i1> %p, <vscale x 4 x float> %in) {
337 ; CHECK-LABEL: sel_merge_nx4f32_zero:
339 ; CHECK-NEXT: mov z0.s, p0/m, #0 // =0x0
341 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x float> zeroinitializer, <vscale x 4 x float> %in
342 ret <vscale x 4 x float> %sel
345 define <vscale x 2 x float> @sel_merge_nx2f32_zero(<vscale x 2 x i1> %p, <vscale x 2 x float> %in) {
346 ; CHECK-LABEL: sel_merge_nx2f32_zero:
348 ; CHECK-NEXT: mov z0.d, p0/m, #0 // =0x0
350 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x float> zeroinitializer, <vscale x 2 x float> %in
351 ret <vscale x 2 x float> %sel
354 define <vscale x 2 x double> @sel_merge_nx2f64_zero(<vscale x 2 x i1> %p, <vscale x 2 x double> %in) {
355 ; CHECK-LABEL: sel_merge_nx2f64_zero:
357 ; CHECK-NEXT: mov z0.d, p0/m, #0 // =0x0
359 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x double> zeroinitializer, <vscale x 2 x double> %in
360 ret <vscale x 2 x double> %sel
363 define <vscale x 8 x half> @sel_merge_nxv8f16_negative_zero(<vscale x 8 x i1> %p, <vscale x 8 x half> %in) {
364 ; CHECK-LABEL: sel_merge_nxv8f16_negative_zero:
366 ; CHECK-NEXT: mov w8, #32768 // =0x8000
367 ; CHECK-NEXT: mov z1.h, w8
368 ; CHECK-NEXT: mov z0.h, p0/m, z1.h
370 %vec = shufflevector <vscale x 8 x half> insertelement (<vscale x 8 x half> undef, half -0.0, i32 0), <vscale x 8 x half> zeroinitializer, <vscale x 8 x i32> zeroinitializer
371 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x half> %vec, <vscale x 8 x half> %in
372 ret <vscale x 8 x half> %sel
375 define <vscale x 4 x half> @sel_merge_nx4f16_negative_zero(<vscale x 4 x i1> %p, <vscale x 4 x half> %in) {
376 ; CHECK-LABEL: sel_merge_nx4f16_negative_zero:
378 ; CHECK-NEXT: mov w8, #32768 // =0x8000
379 ; CHECK-NEXT: mov z1.h, w8
380 ; CHECK-NEXT: mov z0.s, p0/m, z1.s
382 %vec = shufflevector <vscale x 4 x half> insertelement (<vscale x 4 x half> undef, half -0.0, i32 0), <vscale x 4 x half> zeroinitializer, <vscale x 4 x i32> zeroinitializer
383 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x half> %vec, <vscale x 4 x half> %in
384 ret <vscale x 4 x half> %sel
387 define <vscale x 2 x half> @sel_merge_nx2f16_negative_zero(<vscale x 2 x i1> %p, <vscale x 2 x half> %in) {
388 ; CHECK-LABEL: sel_merge_nx2f16_negative_zero:
390 ; CHECK-NEXT: mov w8, #32768 // =0x8000
391 ; CHECK-NEXT: mov z1.h, w8
392 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
394 %vec = shufflevector <vscale x 2 x half> insertelement (<vscale x 2 x half> undef, half -0.0, i32 0), <vscale x 2 x half> zeroinitializer, <vscale x 2 x i32> zeroinitializer
395 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x half> %vec, <vscale x 2 x half> %in
396 ret <vscale x 2 x half> %sel
399 define <vscale x 4 x float> @sel_merge_nx4f32_negative_zero(<vscale x 4 x i1> %p, <vscale x 4 x float> %in) {
400 ; CHECK-LABEL: sel_merge_nx4f32_negative_zero:
402 ; CHECK-NEXT: mov w8, #-2147483648 // =0x80000000
403 ; CHECK-NEXT: mov z1.s, w8
404 ; CHECK-NEXT: mov z0.s, p0/m, z1.s
406 %vec = shufflevector <vscale x 4 x float> insertelement (<vscale x 4 x float> undef, float -0.0, i32 0), <vscale x 4 x float> zeroinitializer, <vscale x 4 x i32> zeroinitializer
407 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x float> %vec, <vscale x 4 x float> %in
408 ret <vscale x 4 x float> %sel
411 define <vscale x 2 x float> @sel_merge_nx2f32_negative_zero(<vscale x 2 x i1> %p, <vscale x 2 x float> %in) {
412 ; CHECK-LABEL: sel_merge_nx2f32_negative_zero:
414 ; CHECK-NEXT: mov w8, #-2147483648 // =0x80000000
415 ; CHECK-NEXT: mov z1.s, w8
416 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
418 %vec = shufflevector <vscale x 2 x float> insertelement (<vscale x 2 x float> undef, float -0.0, i32 0), <vscale x 2 x float> zeroinitializer, <vscale x 2 x i32> zeroinitializer
419 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x float> %vec, <vscale x 2 x float> %in
420 ret <vscale x 2 x float> %sel
423 define <vscale x 2 x double> @sel_merge_nx2f64_negative_zero(<vscale x 2 x i1> %p, <vscale x 2 x double> %in) {
424 ; CHECK-LABEL: sel_merge_nx2f64_negative_zero:
426 ; CHECK-NEXT: mov x8, #-9223372036854775808 // =0x8000000000000000
427 ; CHECK-NEXT: mov z1.d, x8
428 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
430 %vec = shufflevector <vscale x 2 x double> insertelement (<vscale x 2 x double> undef, double -0.0, i32 0), <vscale x 2 x double> zeroinitializer, <vscale x 2 x i32> zeroinitializer
431 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x double> %vec, <vscale x 2 x double> %in
432 ret <vscale x 2 x double> %sel
435 define <vscale x 8 x i16> @sel_merge_16_shifted(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
436 ; CHECK-LABEL: sel_merge_16_shifted:
438 ; CHECK-NEXT: mov z0.h, p0/m, #512 // =0x200
440 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 512, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
441 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> %in
442 ret <vscale x 8 x i16> %sel
445 define <vscale x 4 x i32> @sel_merge_32_shifted(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
446 ; CHECK-LABEL: sel_merge_32_shifted:
448 ; CHECK-NEXT: mov z0.s, p0/m, #512 // =0x200
450 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 512, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
451 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> %in
452 ret <vscale x 4 x i32> %sel
455 define <vscale x 2 x i64> @sel_merge_64_shifted(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
456 ; CHECK-LABEL: sel_merge_64_shifted:
458 ; CHECK-NEXT: mov z0.d, p0/m, #512 // =0x200
460 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 512, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
461 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> %in
462 ret <vscale x 2 x i64> %sel
465 ; TODO: We could actually use something like "cpy z0.b, p0/m, #-128". But it's
466 ; a little tricky to prove correctness: we're using the predicate with the
467 ; wrong width, so we'd have to prove the bits which would normally be unused
469 define <vscale x 8 x i16> @sel_merge_16_illegal_wrong_extension(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
470 ; CHECK-LABEL: sel_merge_16_illegal_wrong_extension:
472 ; CHECK-NEXT: mov z1.h, #128 // =0x80
473 ; CHECK-NEXT: mov z0.h, p0/m, z1.h
475 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 128, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
476 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> %in
477 ret <vscale x 8 x i16> %sel
480 define <vscale x 4 x i32> @sel_merge_32_illegal_wrong_extension(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
481 ; CHECK-LABEL: sel_merge_32_illegal_wrong_extension:
483 ; CHECK-NEXT: mov z1.s, #128 // =0x80
484 ; CHECK-NEXT: mov z0.s, p0/m, z1.s
486 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 128, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
487 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> %in
488 ret <vscale x 4 x i32> %sel
491 define <vscale x 2 x i64> @sel_merge_64_illegal_wrong_extension(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
492 ; CHECK-LABEL: sel_merge_64_illegal_wrong_extension:
494 ; CHECK-NEXT: mov z1.d, #128 // =0x80
495 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
497 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 128, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
498 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> %in
499 ret <vscale x 2 x i64> %sel
502 define <vscale x 8 x i16> @sel_merge_16_illegal_shifted(<vscale x 8 x i1> %p, <vscale x 8 x i16> %in) {
503 ; CHECK-LABEL: sel_merge_16_illegal_shifted:
505 ; CHECK-NEXT: mov w8, #513 // =0x201
506 ; CHECK-NEXT: mov z1.h, w8
507 ; CHECK-NEXT: mov z0.h, p0/m, z1.h
509 %vec = shufflevector <vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 513, i32 0), <vscale x 8 x i16> zeroinitializer, <vscale x 8 x i32> zeroinitializer
510 %sel = select <vscale x 8 x i1> %p, <vscale x 8 x i16> %vec, <vscale x 8 x i16> %in
511 ret <vscale x 8 x i16> %sel
514 define <vscale x 4 x i32> @sel_merge_32_illegal_shifted(<vscale x 4 x i1> %p, <vscale x 4 x i32> %in) {
515 ; CHECK-LABEL: sel_merge_32_illegal_shifted:
517 ; CHECK-NEXT: mov w8, #513 // =0x201
518 ; CHECK-NEXT: mov z1.s, w8
519 ; CHECK-NEXT: mov z0.s, p0/m, z1.s
521 %vec = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 513, i32 0), <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer
522 %sel = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %vec, <vscale x 4 x i32> %in
523 ret <vscale x 4 x i32> %sel
526 define <vscale x 2 x i64> @sel_merge_64_illegal_shifted(<vscale x 2 x i1> %p, <vscale x 2 x i64> %in) {
527 ; CHECK-LABEL: sel_merge_64_illegal_shifted:
529 ; CHECK-NEXT: mov w8, #513 // =0x201
530 ; CHECK-NEXT: mov z1.d, x8
531 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
533 %vec = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 513, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
534 %sel = select <vscale x 2 x i1> %p, <vscale x 2 x i64> %vec, <vscale x 2 x i64> %in
535 ret <vscale x 2 x i64> %sel