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
7 define <vscale x 16 x i8> @smax_i8_pos(<vscale x 16 x i8> %a) {
8 ; CHECK-LABEL: smax_i8_pos:
10 ; CHECK-NEXT: smax z0.b, z0.b, #27
12 %elt = insertelement <vscale x 16 x i8> undef, i8 27, i32 0
13 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
14 %cmp = icmp sgt <vscale x 16 x i8> %a, %splat
15 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
16 ret <vscale x 16 x i8> %res
19 define <vscale x 16 x i8> @smax_i8_neg(<vscale x 16 x i8> %a) {
20 ; CHECK-LABEL: smax_i8_neg:
22 ; CHECK-NEXT: smax z0.b, z0.b, #-58
24 %elt = insertelement <vscale x 16 x i8> undef, i8 -58, i32 0
25 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
26 %cmp = icmp sgt <vscale x 16 x i8> %a, %splat
27 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
28 ret <vscale x 16 x i8> %res
31 define <vscale x 8 x i16> @smax_i16_pos(<vscale x 8 x i16> %a) {
32 ; CHECK-LABEL: smax_i16_pos:
34 ; CHECK-NEXT: smax z0.h, z0.h, #27
36 %elt = insertelement <vscale x 8 x i16> undef, i16 27, i32 0
37 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
38 %cmp = icmp sgt <vscale x 8 x i16> %a, %splat
39 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
40 ret <vscale x 8 x i16> %res
43 define <vscale x 8 x i16> @smax_i16_neg(<vscale x 8 x i16> %a) {
44 ; CHECK-LABEL: smax_i16_neg:
46 ; CHECK-NEXT: smax z0.h, z0.h, #-58
48 %elt = insertelement <vscale x 8 x i16> undef, i16 -58, i32 0
49 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
50 %cmp = icmp sgt <vscale x 8 x i16> %a, %splat
51 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
52 ret <vscale x 8 x i16> %res
55 define <vscale x 8 x i16> @smax_i16_out_of_range(<vscale x 8 x i16> %a) {
56 ; CHECK-LABEL: smax_i16_out_of_range:
58 ; CHECK-NEXT: mov w8, #257
59 ; CHECK-NEXT: mov z1.h, w8
60 ; CHECK-NEXT: ptrue p0.h
61 ; CHECK-NEXT: smax z0.h, p0/m, z0.h, z1.h
63 %elt = insertelement <vscale x 8 x i16> undef, i16 257, i32 0
64 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
65 %cmp = icmp sgt <vscale x 8 x i16> %a, %splat
66 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
67 ret <vscale x 8 x i16> %res
70 define <vscale x 4 x i32> @smax_i32_pos(<vscale x 4 x i32> %a) {
71 ; CHECK-LABEL: smax_i32_pos:
73 ; CHECK-NEXT: smax z0.s, z0.s, #27
75 %elt = insertelement <vscale x 4 x i32> undef, i32 27, i32 0
76 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
77 %cmp = icmp sgt <vscale x 4 x i32> %a, %splat
78 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
79 ret <vscale x 4 x i32> %res
82 define <vscale x 4 x i32> @smax_i32_neg(<vscale x 4 x i32> %a) {
83 ; CHECK-LABEL: smax_i32_neg:
85 ; CHECK-NEXT: smax z0.s, z0.s, #-58
87 %elt = insertelement <vscale x 4 x i32> undef, i32 -58, i32 0
88 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
89 %cmp = icmp sgt <vscale x 4 x i32> %a, %splat
90 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
91 ret <vscale x 4 x i32> %res
94 define <vscale x 4 x i32> @smax_i32_out_of_range(<vscale x 4 x i32> %a) {
95 ; CHECK-LABEL: smax_i32_out_of_range:
97 ; CHECK-NEXT: mov w8, #-129
98 ; CHECK-NEXT: mov z1.s, w8
99 ; CHECK-NEXT: ptrue p0.s
100 ; CHECK-NEXT: smax z0.s, p0/m, z0.s, z1.s
102 %elt = insertelement <vscale x 4 x i32> undef, i32 -129, i32 0
103 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
104 %cmp = icmp sgt <vscale x 4 x i32> %a, %splat
105 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
106 ret <vscale x 4 x i32> %res
109 define <vscale x 2 x i64> @smax_i64_pos(<vscale x 2 x i64> %a) {
110 ; CHECK-LABEL: smax_i64_pos:
112 ; CHECK-NEXT: smax z0.d, z0.d, #27
114 %elt = insertelement <vscale x 2 x i64> undef, i64 27, i32 0
115 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
116 %cmp = icmp sgt <vscale x 2 x i64> %a, %splat
117 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
118 ret <vscale x 2 x i64> %res
121 define <vscale x 2 x i64> @smax_i64_neg(<vscale x 2 x i64> %a) {
122 ; CHECK-LABEL: smax_i64_neg:
124 ; CHECK-NEXT: smax z0.d, z0.d, #-58
126 %elt = insertelement <vscale x 2 x i64> undef, i64 -58, i32 0
127 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
128 %cmp = icmp sgt <vscale x 2 x i64> %a, %splat
129 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
130 ret <vscale x 2 x i64> %res
133 define <vscale x 2 x i64> @smax_i64_out_of_range(<vscale x 2 x i64> %a) {
134 ; CHECK-LABEL: smax_i64_out_of_range:
136 ; CHECK-NEXT: mov w8, #65535
137 ; CHECK-NEXT: mov z1.d, x8
138 ; CHECK-NEXT: ptrue p0.d
139 ; CHECK-NEXT: smax z0.d, p0/m, z0.d, z1.d
141 %elt = insertelement <vscale x 2 x i64> undef, i64 65535, i32 0
142 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
143 %cmp = icmp sgt <vscale x 2 x i64> %a, %splat
144 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
145 ret <vscale x 2 x i64> %res
151 define <vscale x 16 x i8> @smin_i8_pos(<vscale x 16 x i8> %a) {
152 ; CHECK-LABEL: smin_i8_pos:
154 ; CHECK-NEXT: smin z0.b, z0.b, #27
156 %elt = insertelement <vscale x 16 x i8> undef, i8 27, i32 0
157 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
158 %cmp = icmp slt <vscale x 16 x i8> %a, %splat
159 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
160 ret <vscale x 16 x i8> %res
163 define <vscale x 16 x i8> @smin_i8_neg(<vscale x 16 x i8> %a) {
164 ; CHECK-LABEL: smin_i8_neg:
166 ; CHECK-NEXT: smin z0.b, z0.b, #-58
168 %elt = insertelement <vscale x 16 x i8> undef, i8 -58, i32 0
169 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
170 %cmp = icmp slt <vscale x 16 x i8> %a, %splat
171 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
172 ret <vscale x 16 x i8> %res
175 define <vscale x 8 x i16> @smin_i16_pos(<vscale x 8 x i16> %a) {
176 ; CHECK-LABEL: smin_i16_pos:
178 ; CHECK-NEXT: smin z0.h, z0.h, #27
180 %elt = insertelement <vscale x 8 x i16> undef, i16 27, i32 0
181 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
182 %cmp = icmp slt <vscale x 8 x i16> %a, %splat
183 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
184 ret <vscale x 8 x i16> %res
187 define <vscale x 8 x i16> @smin_i16_neg(<vscale x 8 x i16> %a) {
188 ; CHECK-LABEL: smin_i16_neg:
190 ; CHECK-NEXT: smin z0.h, z0.h, #-58
192 %elt = insertelement <vscale x 8 x i16> undef, i16 -58, i32 0
193 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
194 %cmp = icmp slt <vscale x 8 x i16> %a, %splat
195 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
196 ret <vscale x 8 x i16> %res
199 define <vscale x 8 x i16> @smin_i16_out_of_range(<vscale x 8 x i16> %a) {
200 ; CHECK-LABEL: smin_i16_out_of_range:
202 ; CHECK-NEXT: mov w8, #257
203 ; CHECK-NEXT: mov z1.h, w8
204 ; CHECK-NEXT: ptrue p0.h
205 ; CHECK-NEXT: smin z0.h, p0/m, z0.h, z1.h
207 %elt = insertelement <vscale x 8 x i16> undef, i16 257, i32 0
208 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
209 %cmp = icmp slt <vscale x 8 x i16> %a, %splat
210 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
211 ret <vscale x 8 x i16> %res
214 define <vscale x 4 x i32> @smin_i32_pos(<vscale x 4 x i32> %a) {
215 ; CHECK-LABEL: smin_i32_pos:
217 ; CHECK-NEXT: smin z0.s, z0.s, #27
219 %elt = insertelement <vscale x 4 x i32> undef, i32 27, i32 0
220 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
221 %cmp = icmp slt <vscale x 4 x i32> %a, %splat
222 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
223 ret <vscale x 4 x i32> %res
226 define <vscale x 4 x i32> @smin_i32_neg(<vscale x 4 x i32> %a) {
227 ; CHECK-LABEL: smin_i32_neg:
229 ; CHECK-NEXT: smin z0.s, z0.s, #-58
231 %elt = insertelement <vscale x 4 x i32> undef, i32 -58, i32 0
232 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
233 %cmp = icmp slt <vscale x 4 x i32> %a, %splat
234 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
235 ret <vscale x 4 x i32> %res
238 define <vscale x 4 x i32> @smin_i32_out_of_range(<vscale x 4 x i32> %a) {
239 ; CHECK-LABEL: smin_i32_out_of_range:
241 ; CHECK-NEXT: mov w8, #-129
242 ; CHECK-NEXT: mov z1.s, w8
243 ; CHECK-NEXT: ptrue p0.s
244 ; CHECK-NEXT: smin z0.s, p0/m, z0.s, z1.s
246 %elt = insertelement <vscale x 4 x i32> undef, i32 -129, i32 0
247 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
248 %cmp = icmp slt <vscale x 4 x i32> %a, %splat
249 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
250 ret <vscale x 4 x i32> %res
253 define <vscale x 2 x i64> @smin_i64_pos(<vscale x 2 x i64> %a) {
254 ; CHECK-LABEL: smin_i64_pos:
256 ; CHECK-NEXT: smin z0.d, z0.d, #27
258 %elt = insertelement <vscale x 2 x i64> undef, i64 27, i32 0
259 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
260 %cmp = icmp slt <vscale x 2 x i64> %a, %splat
261 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
262 ret <vscale x 2 x i64> %res
265 define <vscale x 2 x i64> @smin_i64_neg(<vscale x 2 x i64> %a) {
266 ; CHECK-LABEL: smin_i64_neg:
268 ; CHECK-NEXT: smin z0.d, z0.d, #-58
270 %elt = insertelement <vscale x 2 x i64> undef, i64 -58, i32 0
271 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
272 %cmp = icmp slt <vscale x 2 x i64> %a, %splat
273 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
274 ret <vscale x 2 x i64> %res
277 define <vscale x 2 x i64> @smin_i64_out_of_range(<vscale x 2 x i64> %a) {
278 ; CHECK-LABEL: smin_i64_out_of_range:
280 ; CHECK-NEXT: mov w8, #65535
281 ; CHECK-NEXT: mov z1.d, x8
282 ; CHECK-NEXT: ptrue p0.d
283 ; CHECK-NEXT: smin z0.d, p0/m, z0.d, z1.d
285 %elt = insertelement <vscale x 2 x i64> undef, i64 65535, i32 0
286 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
287 %cmp = icmp slt <vscale x 2 x i64> %a, %splat
288 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
289 ret <vscale x 2 x i64> %res
295 define <vscale x 16 x i8> @umax_i8_pos(<vscale x 16 x i8> %a) {
296 ; CHECK-LABEL: umax_i8_pos:
298 ; CHECK-NEXT: umax z0.b, z0.b, #27
300 %elt = insertelement <vscale x 16 x i8> undef, i8 27, i32 0
301 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
302 %cmp = icmp ugt <vscale x 16 x i8> %a, %splat
303 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
304 ret <vscale x 16 x i8> %res
307 define <vscale x 16 x i8> @umax_i8_large(<vscale x 16 x i8> %a) {
308 ; CHECK-LABEL: umax_i8_large:
310 ; CHECK-NEXT: umax z0.b, z0.b, #129
312 %elt = insertelement <vscale x 16 x i8> undef, i8 129, i32 0
313 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
314 %cmp = icmp ugt <vscale x 16 x i8> %a, %splat
315 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
316 ret <vscale x 16 x i8> %res
319 define <vscale x 8 x i16> @umax_i16_pos(<vscale x 8 x i16> %a) {
320 ; CHECK-LABEL: umax_i16_pos:
322 ; CHECK-NEXT: umax z0.h, z0.h, #27
324 %elt = insertelement <vscale x 8 x i16> undef, i16 27, i32 0
325 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
326 %cmp = icmp ugt <vscale x 8 x i16> %a, %splat
327 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
328 ret <vscale x 8 x i16> %res
331 define <vscale x 8 x i16> @umax_i16_out_of_range(<vscale x 8 x i16> %a) {
332 ; CHECK-LABEL: umax_i16_out_of_range:
334 ; CHECK-NEXT: mov w8, #257
335 ; CHECK-NEXT: mov z1.h, w8
336 ; CHECK-NEXT: ptrue p0.h
337 ; CHECK-NEXT: umax z0.h, p0/m, z0.h, z1.h
339 %elt = insertelement <vscale x 8 x i16> undef, i16 257, i32 0
340 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
341 %cmp = icmp ugt <vscale x 8 x i16> %a, %splat
342 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
343 ret <vscale x 8 x i16> %res
346 define <vscale x 4 x i32> @umax_i32_pos(<vscale x 4 x i32> %a) {
347 ; CHECK-LABEL: umax_i32_pos:
349 ; CHECK-NEXT: umax z0.s, z0.s, #27
351 %elt = insertelement <vscale x 4 x i32> undef, i32 27, i32 0
352 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
353 %cmp = icmp ugt <vscale x 4 x i32> %a, %splat
354 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
355 ret <vscale x 4 x i32> %res
358 define <vscale x 4 x i32> @umax_i32_out_of_range(<vscale x 4 x i32> %a) {
359 ; CHECK-LABEL: umax_i32_out_of_range:
361 ; CHECK-NEXT: mov w8, #257
362 ; CHECK-NEXT: mov z1.s, w8
363 ; CHECK-NEXT: ptrue p0.s
364 ; CHECK-NEXT: umax z0.s, p0/m, z0.s, z1.s
366 %elt = insertelement <vscale x 4 x i32> undef, i32 257, i32 0
367 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
368 %cmp = icmp ugt <vscale x 4 x i32> %a, %splat
369 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
370 ret <vscale x 4 x i32> %res
373 define <vscale x 2 x i64> @umax_i64_pos(<vscale x 2 x i64> %a) {
374 ; CHECK-LABEL: umax_i64_pos:
376 ; CHECK-NEXT: umax z0.d, z0.d, #27
378 %elt = insertelement <vscale x 2 x i64> undef, i64 27, i32 0
379 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
380 %cmp = icmp ugt <vscale x 2 x i64> %a, %splat
381 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
382 ret <vscale x 2 x i64> %res
385 define <vscale x 2 x i64> @umax_i64_out_of_range(<vscale x 2 x i64> %a) {
386 ; CHECK-LABEL: umax_i64_out_of_range:
388 ; CHECK-NEXT: mov w8, #65535
389 ; CHECK-NEXT: mov z1.d, x8
390 ; CHECK-NEXT: ptrue p0.d
391 ; CHECK-NEXT: umax z0.d, p0/m, z0.d, z1.d
393 %elt = insertelement <vscale x 2 x i64> undef, i64 65535, i32 0
394 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
395 %cmp = icmp ugt <vscale x 2 x i64> %a, %splat
396 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
397 ret <vscale x 2 x i64> %res
403 define <vscale x 16 x i8> @umin_i8_pos(<vscale x 16 x i8> %a) {
404 ; CHECK-LABEL: umin_i8_pos:
406 ; CHECK-NEXT: umin z0.b, z0.b, #27
408 %elt = insertelement <vscale x 16 x i8> undef, i8 27, i32 0
409 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
410 %cmp = icmp ult <vscale x 16 x i8> %a, %splat
411 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
412 ret <vscale x 16 x i8> %res
415 define <vscale x 16 x i8> @umin_i8_large(<vscale x 16 x i8> %a) {
416 ; CHECK-LABEL: umin_i8_large:
418 ; CHECK-NEXT: umin z0.b, z0.b, #129
420 %elt = insertelement <vscale x 16 x i8> undef, i8 129, i32 0
421 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
422 %cmp = icmp ult <vscale x 16 x i8> %a, %splat
423 %res = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %a, <vscale x 16 x i8> %splat
424 ret <vscale x 16 x i8> %res
427 define <vscale x 8 x i16> @umin_i16_pos(<vscale x 8 x i16> %a) {
428 ; CHECK-LABEL: umin_i16_pos:
430 ; CHECK-NEXT: umin z0.h, z0.h, #27
432 %elt = insertelement <vscale x 8 x i16> undef, i16 27, i32 0
433 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
434 %cmp = icmp ult <vscale x 8 x i16> %a, %splat
435 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
436 ret <vscale x 8 x i16> %res
439 define <vscale x 8 x i16> @umin_i16_out_of_range(<vscale x 8 x i16> %a) {
440 ; CHECK-LABEL: umin_i16_out_of_range:
442 ; CHECK-NEXT: mov w8, #257
443 ; CHECK-NEXT: mov z1.h, w8
444 ; CHECK-NEXT: ptrue p0.h
445 ; CHECK-NEXT: umin z0.h, p0/m, z0.h, z1.h
447 %elt = insertelement <vscale x 8 x i16> undef, i16 257, i32 0
448 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
449 %cmp = icmp ult <vscale x 8 x i16> %a, %splat
450 %res = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %a, <vscale x 8 x i16> %splat
451 ret <vscale x 8 x i16> %res
454 define <vscale x 4 x i32> @umin_i32_pos(<vscale x 4 x i32> %a) {
455 ; CHECK-LABEL: umin_i32_pos:
457 ; CHECK-NEXT: umin z0.s, z0.s, #27
459 %elt = insertelement <vscale x 4 x i32> undef, i32 27, i32 0
460 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
461 %cmp = icmp ult <vscale x 4 x i32> %a, %splat
462 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
463 ret <vscale x 4 x i32> %res
466 define <vscale x 4 x i32> @umin_i32_out_of_range(<vscale x 4 x i32> %a) {
467 ; CHECK-LABEL: umin_i32_out_of_range:
469 ; CHECK-NEXT: mov w8, #257
470 ; CHECK-NEXT: mov z1.s, w8
471 ; CHECK-NEXT: ptrue p0.s
472 ; CHECK-NEXT: umin z0.s, p0/m, z0.s, z1.s
474 %elt = insertelement <vscale x 4 x i32> undef, i32 257, i32 0
475 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
476 %cmp = icmp ult <vscale x 4 x i32> %a, %splat
477 %res = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat
478 ret <vscale x 4 x i32> %res
481 define <vscale x 2 x i64> @umin_i64_pos(<vscale x 2 x i64> %a) {
482 ; CHECK-LABEL: umin_i64_pos:
484 ; CHECK-NEXT: umin z0.d, z0.d, #27
486 %elt = insertelement <vscale x 2 x i64> undef, i64 27, i32 0
487 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
488 %cmp = icmp ult <vscale x 2 x i64> %a, %splat
489 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
490 ret <vscale x 2 x i64> %res
493 define <vscale x 2 x i64> @umin_i64_out_of_range(<vscale x 2 x i64> %a) {
494 ; CHECK-LABEL: umin_i64_out_of_range:
496 ; CHECK-NEXT: mov w8, #65535
497 ; CHECK-NEXT: mov z1.d, x8
498 ; CHECK-NEXT: ptrue p0.d
499 ; CHECK-NEXT: umin z0.d, p0/m, z0.d, z1.d
501 %elt = insertelement <vscale x 2 x i64> undef, i64 65535, i32 0
502 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
503 %cmp = icmp ult <vscale x 2 x i64> %a, %splat
504 %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat
505 ret <vscale x 2 x i64> %res
511 define <vscale x 16 x i8> @mul_i8_neg(<vscale x 16 x i8> %a) {
512 ; CHECK-LABEL: mul_i8_neg:
514 ; CHECK-NEXT: mul z0.b, z0.b, #-17
516 %elt = insertelement <vscale x 16 x i8> undef, i8 -17, i32 0
517 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
518 %res = mul <vscale x 16 x i8> %a, %splat
519 ret <vscale x 16 x i8> %res
522 define <vscale x 16 x i8> @mul_i8_pos(<vscale x 16 x i8> %a) {
523 ; CHECK-LABEL: mul_i8_pos:
525 ; CHECK-NEXT: mul z0.b, z0.b, #105
527 %elt = insertelement <vscale x 16 x i8> undef, i8 105, i32 0
528 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
529 %res = mul <vscale x 16 x i8> %a, %splat
530 ret <vscale x 16 x i8> %res
533 define <vscale x 8 x i16> @mul_i16_neg(<vscale x 8 x i16> %a) {
534 ; CHECK-LABEL: mul_i16_neg:
536 ; CHECK-NEXT: mul z0.h, z0.h, #-17
538 %elt = insertelement <vscale x 8 x i16> undef, i16 -17, i32 0
539 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
540 %res = mul <vscale x 8 x i16> %a, %splat
541 ret <vscale x 8 x i16> %res
544 define <vscale x 8 x i16> @mul_i16_pos(<vscale x 8 x i16> %a) {
545 ; CHECK-LABEL: mul_i16_pos:
547 ; CHECK-NEXT: mul z0.h, z0.h, #105
549 %elt = insertelement <vscale x 8 x i16> undef, i16 105, i32 0
550 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
551 %res = mul <vscale x 8 x i16> %a, %splat
552 ret <vscale x 8 x i16> %res
555 define <vscale x 4 x i32> @mul_i32_neg(<vscale x 4 x i32> %a) {
556 ; CHECK-LABEL: mul_i32_neg:
558 ; CHECK-NEXT: mul z0.s, z0.s, #-17
560 %elt = insertelement <vscale x 4 x i32> undef, i32 -17, i32 0
561 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
562 %res = mul <vscale x 4 x i32> %a, %splat
563 ret <vscale x 4 x i32> %res
566 define <vscale x 4 x i32> @mul_i32_pos(<vscale x 4 x i32> %a) {
567 ; CHECK-LABEL: mul_i32_pos:
569 ; CHECK-NEXT: mul z0.s, z0.s, #105
571 %elt = insertelement <vscale x 4 x i32> undef, i32 105, i32 0
572 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
573 %res = mul <vscale x 4 x i32> %a, %splat
574 ret <vscale x 4 x i32> %res
577 define <vscale x 2 x i64> @mul_i64_neg(<vscale x 2 x i64> %a) {
578 ; CHECK-LABEL: mul_i64_neg:
580 ; CHECK-NEXT: mul z0.d, z0.d, #-17
582 %elt = insertelement <vscale x 2 x i64> undef, i64 -17, i32 0
583 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
584 %res = mul <vscale x 2 x i64> %a, %splat
585 ret <vscale x 2 x i64> %res
588 define <vscale x 2 x i64> @mul_i64_pos(<vscale x 2 x i64> %a) {
589 ; CHECK-LABEL: mul_i64_pos:
591 ; CHECK-NEXT: mul z0.d, z0.d, #105
593 %elt = insertelement <vscale x 2 x i64> undef, i64 105, i32 0
594 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
595 %res = mul <vscale x 2 x i64> %a, %splat
596 ret <vscale x 2 x i64> %res
599 define <vscale x 8 x i16> @mul_i16_range(<vscale x 8 x i16> %a) {
600 ; CHECK-LABEL: mul_i16_range:
602 ; CHECK-NEXT: mov w8, #255
603 ; CHECK-NEXT: mov z1.h, w8
604 ; CHECK-NEXT: ptrue p0.h
605 ; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h
607 %elt = insertelement <vscale x 8 x i16> undef, i16 255, i32 0
608 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
609 %res = mul <vscale x 8 x i16> %a, %splat
610 ret <vscale x 8 x i16> %res
613 define <vscale x 4 x i32> @mul_i32_range(<vscale x 4 x i32> %a) {
614 ; CHECK-LABEL: mul_i32_range:
616 ; CHECK-NEXT: mov w8, #255
617 ; CHECK-NEXT: mov z1.s, w8
618 ; CHECK-NEXT: ptrue p0.s
619 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
621 %elt = insertelement <vscale x 4 x i32> undef, i32 255, i32 0
622 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
623 %res = mul <vscale x 4 x i32> %a, %splat
624 ret <vscale x 4 x i32> %res
627 define <vscale x 2 x i64> @mul_i64_range(<vscale x 2 x i64> %a) {
628 ; CHECK-LABEL: mul_i64_range:
630 ; CHECK-NEXT: mov w8, #255
631 ; CHECK-NEXT: mov z1.d, x8
632 ; CHECK-NEXT: ptrue p0.d
633 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
635 %elt = insertelement <vscale x 2 x i64> undef, i64 255, i32 0
636 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
637 %res = mul <vscale x 2 x i64> %a, %splat
638 ret <vscale x 2 x i64> %res
643 define <vscale x 16 x i8> @asr_i8(<vscale x 16 x i8> %a){
644 ; CHECK-LABEL: asr_i8:
646 ; CHECK-NEXT: asr z0.b, z0.b, #7
648 %elt = insertelement <vscale x 16 x i8> undef, i8 7, i32 0
649 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
650 %lshr = ashr <vscale x 16 x i8> %a, %splat
651 ret <vscale x 16 x i8> %lshr
654 define <vscale x 8 x i16> @asr_i16(<vscale x 8 x i16> %a){
655 ; CHECK-LABEL: asr_i16:
657 ; CHECK-NEXT: asr z0.h, z0.h, #15
659 %elt = insertelement <vscale x 8 x i16> undef, i16 15, i32 0
660 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
661 %ashr = ashr <vscale x 8 x i16> %a, %splat
662 ret <vscale x 8 x i16> %ashr
665 define <vscale x 4 x i32> @asr_i32(<vscale x 4 x i32> %a){
666 ; CHECK-LABEL: asr_i32:
668 ; CHECK-NEXT: asr z0.s, z0.s, #31
670 %elt = insertelement <vscale x 4 x i32> undef, i32 31, i32 0
671 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
672 %ashr = ashr <vscale x 4 x i32> %a, %splat
673 ret <vscale x 4 x i32> %ashr
676 define <vscale x 2 x i64> @asr_i64(<vscale x 2 x i64> %a){
677 ; CHECK-LABEL: asr_i64:
679 ; CHECK-NEXT: asr z0.d, z0.d, #63
681 %elt = insertelement <vscale x 2 x i64> undef, i64 63, i32 0
682 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
683 %ashr = ashr <vscale x 2 x i64> %a, %splat
684 ret <vscale x 2 x i64> %ashr
689 define <vscale x 16 x i8> @lsl_i8(<vscale x 16 x i8> %a){
690 ; CHECK-LABEL: lsl_i8:
692 ; CHECK-NEXT: lsl z0.b, z0.b, #7
694 %elt = insertelement <vscale x 16 x i8> undef, i8 7, i32 0
695 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
696 %shl = shl <vscale x 16 x i8> %a, %splat
697 ret <vscale x 16 x i8> %shl
700 define <vscale x 8 x i16> @lsl_i16(<vscale x 8 x i16> %a){
701 ; CHECK-LABEL: lsl_i16:
703 ; CHECK-NEXT: lsl z0.h, z0.h, #15
705 %elt = insertelement <vscale x 8 x i16> undef, i16 15, i32 0
706 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
707 %shl = shl <vscale x 8 x i16> %a, %splat
708 ret <vscale x 8 x i16> %shl
711 define <vscale x 4 x i32> @lsl_i32(<vscale x 4 x i32> %a){
712 ; CHECK-LABEL: lsl_i32:
714 ; CHECK-NEXT: lsl z0.s, z0.s, #31
716 %elt = insertelement <vscale x 4 x i32> undef, i32 31, i32 0
717 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
718 %shl = shl <vscale x 4 x i32> %a, %splat
719 ret <vscale x 4 x i32> %shl
722 define <vscale x 2 x i64> @lsl_i64(<vscale x 2 x i64> %a){
723 ; CHECK-LABEL: lsl_i64:
725 ; CHECK-NEXT: lsl z0.d, z0.d, #63
727 %elt = insertelement <vscale x 2 x i64> undef, i64 63, i32 0
728 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
729 %shl = shl <vscale x 2 x i64> %a, %splat
730 ret <vscale x 2 x i64> %shl
735 define <vscale x 16 x i8> @lsr_i8(<vscale x 16 x i8> %a){
736 ; CHECK-LABEL: lsr_i8:
738 ; CHECK-NEXT: lsr z0.b, z0.b, #7
740 %elt = insertelement <vscale x 16 x i8> undef, i8 7, i32 0
741 %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
742 %lshr = lshr <vscale x 16 x i8> %a, %splat
743 ret <vscale x 16 x i8> %lshr
746 define <vscale x 8 x i16> @lsr_i16(<vscale x 8 x i16> %a){
747 ; CHECK-LABEL: lsr_i16:
749 ; CHECK-NEXT: lsr z0.h, z0.h, #15
751 %elt = insertelement <vscale x 8 x i16> undef, i16 15, i32 0
752 %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
753 %lshr = lshr <vscale x 8 x i16> %a, %splat
754 ret <vscale x 8 x i16> %lshr
757 define <vscale x 4 x i32> @lsr_i32(<vscale x 4 x i32> %a){
758 ; CHECK-LABEL: lsr_i32:
760 ; CHECK-NEXT: lsr z0.s, z0.s, #31
762 %elt = insertelement <vscale x 4 x i32> undef, i32 31, i32 0
763 %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
764 %lshr = lshr <vscale x 4 x i32> %a, %splat
765 ret <vscale x 4 x i32> %lshr
768 define <vscale x 2 x i64> @lsr_i64(<vscale x 2 x i64> %a){
769 ; CHECK-LABEL: lsr_i64:
771 ; CHECK-NEXT: lsr z0.d, z0.d, #63
773 %elt = insertelement <vscale x 2 x i64> undef, i64 63, i32 0
774 %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
775 %lshr = lshr <vscale x 2 x i64> %a, %splat
776 ret <vscale x 2 x i64> %lshr
779 define <vscale x 4 x i32> @sdiv_const(<vscale x 4 x i32> %a) #0 {
780 ; CHECK-LABEL: sdiv_const:
781 ; CHECK: // %bb.0: // %entry
782 ; CHECK-NEXT: mov z1.s, #3 // =0x3
783 ; CHECK-NEXT: ptrue p0.s
784 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
787 %div = sdiv <vscale x 4 x i32> %a, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer)
788 ret <vscale x 4 x i32> %div
791 define <vscale x 4 x i32> @udiv_const(<vscale x 4 x i32> %a) #0 {
792 ; CHECK-LABEL: udiv_const:
793 ; CHECK: // %bb.0: // %entry
794 ; CHECK-NEXT: mov z1.s, #3 // =0x3
795 ; CHECK-NEXT: ptrue p0.s
796 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
799 %div = udiv <vscale x 4 x i32> %a, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer)
800 ret <vscale x 4 x i32> %div
806 define <vscale x 8 x i16> @uqsub(<vscale x 8 x i16> %a) {
807 ; CHECK-LABEL: uqsub:
809 ; CHECK-NEXT: uqsub z0.h, z0.h, #32768 // =0x8000
811 %cmp = icmp slt <vscale x 8 x i16> %a, shufflevector (<vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 0, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer)
812 %sub = xor <vscale x 8 x i16> %a, shufflevector (<vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 -32768, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer)
813 %sel = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %sub, <vscale x 8 x i16> shufflevector (<vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 0, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer)
814 ret <vscale x 8 x i16> %sel
817 attributes #0 = { minsize }