1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc < %s -mtriple=ve | FileCheck %s
4 ;;; Test ‘llvm.umin.*’ intrinsic
7 ;;; This is an overloaded intrinsic. You can use @llvm.umin on any
8 ;;; integer bit width or any vector of integer elements.
10 ;;; declare i32 @llvm.umin.i32(i32 %a, i32 %b)
11 ;;; declare <4 x i32> @llvm.umin.v4i32(<4 x i32> %a, <4 x i32> %b)
14 ;;; Return the smaller of %a and %b comparing the values as unsigned
15 ;;; integers. Vector intrinsics operate on a per-element basis. The
16 ;;; smaller element of %a and %b at a given index is returned for
20 ;;; The arguments (%a and %b) may be of any integer type or a vector
21 ;;; with integer element type. The argument types must match each
22 ;;; other, and the return type must match the argument type.
25 ;;; We test only i1/u8/u16/u32/u64/u128.
27 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
28 define zeroext i1 @func_umin_var_i1(i1 noundef zeroext %0, i1 noundef zeroext %1) {
29 ; CHECK-LABEL: func_umin_var_i1:
31 ; CHECK-NEXT: and %s0, %s0, %s1
32 ; CHECK-NEXT: b.l.t (, %s10)
33 %3 = tail call i1 @llvm.umin.i1(i1 %0, i1 %1)
37 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
38 define zeroext i8 @func_umin_var_u8(i8 noundef zeroext %0, i8 noundef zeroext %1) {
39 ; CHECK-LABEL: func_umin_var_u8:
41 ; CHECK-NEXT: mins.w.sx %s0, %s0, %s1
42 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
43 ; CHECK-NEXT: b.l.t (, %s10)
44 %3 = tail call i8 @llvm.umin.i8(i8 %0, i8 %1)
48 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
49 define zeroext i16 @func_umin_var_u16(i16 noundef zeroext %0, i16 noundef zeroext %1) {
50 ; CHECK-LABEL: func_umin_var_u16:
52 ; CHECK-NEXT: mins.w.sx %s0, %s0, %s1
53 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
54 ; CHECK-NEXT: b.l.t (, %s10)
55 %3 = tail call i16 @llvm.umin.i16(i16 %0, i16 %1)
59 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
60 define zeroext i32 @func_umin_var_u32(i32 noundef zeroext %0, i32 noundef zeroext %1) {
61 ; CHECK-LABEL: func_umin_var_u32:
63 ; CHECK-NEXT: cmpu.w %s2, %s0, %s1
64 ; CHECK-NEXT: cmov.w.lt %s1, %s0, %s2
65 ; CHECK-NEXT: adds.w.zx %s0, %s1, (0)1
66 ; CHECK-NEXT: b.l.t (, %s10)
67 %3 = tail call i32 @llvm.umin.i32(i32 %0, i32 %1)
71 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
72 define i64 @func_umin_var_u64(i64 noundef %0, i64 noundef %1) {
73 ; CHECK-LABEL: func_umin_var_u64:
75 ; CHECK-NEXT: cmpu.l %s2, %s0, %s1
76 ; CHECK-NEXT: cmov.l.lt %s1, %s0, %s2
77 ; CHECK-NEXT: or %s0, 0, %s1
78 ; CHECK-NEXT: b.l.t (, %s10)
79 %3 = tail call i64 @llvm.umin.i64(i64 %0, i64 %1)
83 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
84 define i128 @func_umin_var_u128(i128 noundef %0, i128 noundef %1) {
85 ; CHECK-LABEL: func_umin_var_u128:
87 ; CHECK-NEXT: cmpu.l %s4, %s1, %s3
88 ; CHECK-NEXT: or %s5, 0, (0)1
89 ; CHECK-NEXT: or %s6, 0, (0)1
90 ; CHECK-NEXT: cmov.l.lt %s6, (63)0, %s4
91 ; CHECK-NEXT: cmpu.l %s7, %s0, %s2
92 ; CHECK-NEXT: cmov.l.lt %s5, (63)0, %s7
93 ; CHECK-NEXT: cmov.l.eq %s6, %s5, %s4
94 ; CHECK-NEXT: cmov.w.ne %s2, %s0, %s6
95 ; CHECK-NEXT: cmov.w.ne %s3, %s1, %s6
96 ; CHECK-NEXT: or %s0, 0, %s2
97 ; CHECK-NEXT: or %s1, 0, %s3
98 ; CHECK-NEXT: b.l.t (, %s10)
99 %3 = tail call i128 @llvm.umin.i128(i128 %0, i128 %1)
103 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
104 define zeroext i1 @func_umin_fore_zero_i1(i1 noundef zeroext %0) {
105 ; CHECK-LABEL: func_umin_fore_zero_i1:
107 ; CHECK-NEXT: or %s0, 0, (0)1
108 ; CHECK-NEXT: b.l.t (, %s10)
112 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
113 define zeroext i8 @func_umin_fore_zero_u8(i8 noundef zeroext %0) {
114 ; CHECK-LABEL: func_umin_fore_zero_u8:
116 ; CHECK-NEXT: or %s0, 0, (0)1
117 ; CHECK-NEXT: b.l.t (, %s10)
121 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
122 define zeroext i16 @func_umin_fore_zero_u16(i16 noundef zeroext %0) {
123 ; CHECK-LABEL: func_umin_fore_zero_u16:
125 ; CHECK-NEXT: or %s0, 0, (0)1
126 ; CHECK-NEXT: b.l.t (, %s10)
130 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
131 define zeroext i32 @func_umin_fore_zero_u32(i32 noundef zeroext %0) {
132 ; CHECK-LABEL: func_umin_fore_zero_u32:
134 ; CHECK-NEXT: or %s0, 0, (0)1
135 ; CHECK-NEXT: b.l.t (, %s10)
139 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
140 define i64 @func_umin_fore_zero_u64(i64 noundef %0) {
141 ; CHECK-LABEL: func_umin_fore_zero_u64:
143 ; CHECK-NEXT: or %s0, 0, (0)1
144 ; CHECK-NEXT: b.l.t (, %s10)
148 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
149 define i128 @func_umin_fore_zero_u128(i128 noundef %0) {
150 ; CHECK-LABEL: func_umin_fore_zero_u128:
152 ; CHECK-NEXT: or %s0, 0, (0)1
153 ; CHECK-NEXT: or %s1, 0, (0)1
154 ; CHECK-NEXT: b.l.t (, %s10)
158 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
159 define zeroext i1 @func_umin_back_zero_i1(i1 noundef zeroext %0) {
160 ; CHECK-LABEL: func_umin_back_zero_i1:
162 ; CHECK-NEXT: or %s0, 0, (0)1
163 ; CHECK-NEXT: b.l.t (, %s10)
167 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
168 define zeroext i8 @func_umin_back_zero_u8(i8 noundef zeroext %0) {
169 ; CHECK-LABEL: func_umin_back_zero_u8:
171 ; CHECK-NEXT: or %s0, 0, (0)1
172 ; CHECK-NEXT: b.l.t (, %s10)
176 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
177 define zeroext i16 @func_umin_back_zero_u16(i16 noundef zeroext %0) {
178 ; CHECK-LABEL: func_umin_back_zero_u16:
180 ; CHECK-NEXT: or %s0, 0, (0)1
181 ; CHECK-NEXT: b.l.t (, %s10)
185 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
186 define zeroext i32 @func_umin_back_zero_u32(i32 noundef zeroext %0) {
187 ; CHECK-LABEL: func_umin_back_zero_u32:
189 ; CHECK-NEXT: or %s0, 0, (0)1
190 ; CHECK-NEXT: b.l.t (, %s10)
194 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
195 define i64 @func_umin_back_zero_u64(i64 noundef %0) {
196 ; CHECK-LABEL: func_umin_back_zero_u64:
198 ; CHECK-NEXT: or %s0, 0, (0)1
199 ; CHECK-NEXT: b.l.t (, %s10)
203 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
204 define i128 @func_umin_back_zero_u128(i128 noundef %0) {
205 ; CHECK-LABEL: func_umin_back_zero_u128:
207 ; CHECK-NEXT: or %s0, 0, (0)1
208 ; CHECK-NEXT: or %s1, 0, (0)1
209 ; CHECK-NEXT: b.l.t (, %s10)
213 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
214 define zeroext i1 @func_umin_fore_const_i1(i1 noundef returned zeroext %0) {
215 ; CHECK-LABEL: func_umin_fore_const_i1:
217 ; CHECK-NEXT: b.l.t (, %s10)
221 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
222 define zeroext i8 @func_umin_fore_const_u8(i8 noundef returned zeroext %0) {
223 ; CHECK-LABEL: func_umin_fore_const_u8:
225 ; CHECK-NEXT: b.l.t (, %s10)
229 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
230 define zeroext i16 @func_umin_fore_const_u16(i16 noundef zeroext %0) {
231 ; CHECK-LABEL: func_umin_fore_const_u16:
233 ; CHECK-NEXT: mins.w.sx %s0, %s0, (56)0
234 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
235 ; CHECK-NEXT: b.l.t (, %s10)
236 %2 = tail call i16 @llvm.umin.i16(i16 %0, i16 255)
240 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
241 define zeroext i32 @func_umin_fore_const_u32(i32 noundef zeroext %0) {
242 ; CHECK-LABEL: func_umin_fore_const_u32:
244 ; CHECK-NEXT: cmpu.w %s1, %s0, (56)0
245 ; CHECK-NEXT: cmov.w.ge %s0, (56)0, %s1
246 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
247 ; CHECK-NEXT: b.l.t (, %s10)
248 %2 = tail call i32 @llvm.umin.i32(i32 %0, i32 255)
252 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
253 define i64 @func_umin_fore_const_u64(i64 noundef %0) {
254 ; CHECK-LABEL: func_umin_fore_const_u64:
256 ; CHECK-NEXT: cmpu.l %s1, %s0, (56)0
257 ; CHECK-NEXT: cmov.l.ge %s0, (56)0, %s1
258 ; CHECK-NEXT: b.l.t (, %s10)
259 %2 = tail call i64 @llvm.umin.i64(i64 %0, i64 255)
263 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
264 define i128 @func_umin_fore_const_u128(i128 noundef %0) {
265 ; CHECK-LABEL: func_umin_fore_const_u128:
267 ; CHECK-NEXT: cmpu.l %s2, %s0, (56)0
268 ; CHECK-NEXT: cmov.l.ge %s0, (56)0, %s2
269 ; CHECK-NEXT: cmov.l.ne %s0, (56)0, %s1
270 ; CHECK-NEXT: or %s1, 0, (0)1
271 ; CHECK-NEXT: b.l.t (, %s10)
272 %2 = tail call i128 @llvm.umin.i128(i128 %0, i128 255)
276 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
277 define zeroext i1 @func_umin_back_const_i1(i1 noundef returned zeroext %0) {
278 ; CHECK-LABEL: func_umin_back_const_i1:
280 ; CHECK-NEXT: b.l.t (, %s10)
284 ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
285 define zeroext i8 @func_umin_back_const_u8(i8 noundef returned zeroext %0) {
286 ; CHECK-LABEL: func_umin_back_const_u8:
288 ; CHECK-NEXT: b.l.t (, %s10)
292 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
293 define zeroext i16 @func_umin_back_const_u16(i16 noundef zeroext %0) {
294 ; CHECK-LABEL: func_umin_back_const_u16:
296 ; CHECK-NEXT: mins.w.sx %s0, %s0, (56)0
297 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
298 ; CHECK-NEXT: b.l.t (, %s10)
299 %2 = tail call i16 @llvm.umin.i16(i16 %0, i16 255)
303 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
304 define zeroext i32 @func_umin_back_const_u32(i32 noundef zeroext %0) {
305 ; CHECK-LABEL: func_umin_back_const_u32:
307 ; CHECK-NEXT: cmpu.w %s1, %s0, (56)0
308 ; CHECK-NEXT: cmov.w.ge %s0, (56)0, %s1
309 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
310 ; CHECK-NEXT: b.l.t (, %s10)
311 %2 = tail call i32 @llvm.umin.i32(i32 %0, i32 255)
315 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
316 define i64 @func_umin_back_const_u64(i64 noundef %0) {
317 ; CHECK-LABEL: func_umin_back_const_u64:
319 ; CHECK-NEXT: cmpu.l %s1, %s0, (56)0
320 ; CHECK-NEXT: cmov.l.ge %s0, (56)0, %s1
321 ; CHECK-NEXT: b.l.t (, %s10)
322 %2 = tail call i64 @llvm.umin.i64(i64 %0, i64 255)
326 ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
327 define i128 @func_umin_back_const_u128(i128 noundef %0) {
328 ; CHECK-LABEL: func_umin_back_const_u128:
330 ; CHECK-NEXT: cmpu.l %s2, %s0, (56)0
331 ; CHECK-NEXT: cmov.l.ge %s0, (56)0, %s2
332 ; CHECK-NEXT: cmov.l.ne %s0, (56)0, %s1
333 ; CHECK-NEXT: or %s1, 0, (0)1
334 ; CHECK-NEXT: b.l.t (, %s10)
335 %2 = tail call i128 @llvm.umin.i128(i128 %0, i128 255)
339 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
340 declare i32 @llvm.umin.i32(i32, i32)
342 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
343 declare i1 @llvm.umin.i1(i1, i1)
345 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
346 declare i8 @llvm.umin.i8(i8, i8)
348 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
349 declare i16 @llvm.umin.i16(i16, i16)
351 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
352 declare i64 @llvm.umin.i64(i64, i64)
354 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
355 declare i128 @llvm.umin.i128(i128, i128)