xref: /llvm-project/llvm/test/CodeGen/VE/Scalar/umin.ll (revision 4cd1c0749143ce9e78a9cfe176a9fb7a5d34637f)
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
3
4;;; Test ‘llvm.umin.*’ intrinsic
5;;;
6;;; Syntax:
7;;;   This is an overloaded intrinsic. You can use @llvm.umin on any
8;;;   integer bit width or any vector of integer elements.
9;;;
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)
12;;;
13;;; Overview:
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
17;;;   that index.
18;;;
19;;; Arguments:
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.
23;;;
24;;; Note:
25;;;   We test only i1/u8/u16/u32/u64/u128.
26
27; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
28define zeroext i1 @func_umin_var_i1(i1 noundef zeroext %0, i1 noundef zeroext %1) {
29; CHECK-LABEL: func_umin_var_i1:
30; CHECK:       # %bb.0:
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)
34  ret i1 %3
35}
36
37; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
38define zeroext i8 @func_umin_var_u8(i8 noundef zeroext %0, i8 noundef zeroext %1) {
39; CHECK-LABEL: func_umin_var_u8:
40; CHECK:       # %bb.0:
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)
45  ret i8 %3
46}
47
48; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
49define zeroext i16 @func_umin_var_u16(i16 noundef zeroext %0, i16 noundef zeroext %1) {
50; CHECK-LABEL: func_umin_var_u16:
51; CHECK:       # %bb.0:
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)
56  ret i16 %3
57}
58
59; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
60define zeroext i32 @func_umin_var_u32(i32 noundef zeroext %0, i32 noundef zeroext %1) {
61; CHECK-LABEL: func_umin_var_u32:
62; CHECK:       # %bb.0:
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)
68  ret i32 %3
69}
70
71; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
72define i64 @func_umin_var_u64(i64 noundef %0, i64 noundef %1) {
73; CHECK-LABEL: func_umin_var_u64:
74; CHECK:       # %bb.0:
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)
80  ret i64 %3
81}
82
83; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
84define i128 @func_umin_var_u128(i128 noundef %0, i128 noundef %1) {
85; CHECK-LABEL: func_umin_var_u128:
86; CHECK:       # %bb.0:
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)
100  ret i128 %3
101}
102
103; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
104define zeroext i1 @func_umin_fore_zero_i1(i1 noundef zeroext %0) {
105; CHECK-LABEL: func_umin_fore_zero_i1:
106; CHECK:       # %bb.0:
107; CHECK-NEXT:    or %s0, 0, (0)1
108; CHECK-NEXT:    b.l.t (, %s10)
109  ret i1 false
110}
111
112; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
113define zeroext i8 @func_umin_fore_zero_u8(i8 noundef zeroext %0) {
114; CHECK-LABEL: func_umin_fore_zero_u8:
115; CHECK:       # %bb.0:
116; CHECK-NEXT:    or %s0, 0, (0)1
117; CHECK-NEXT:    b.l.t (, %s10)
118  ret i8 0
119}
120
121; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
122define zeroext i16 @func_umin_fore_zero_u16(i16 noundef zeroext %0) {
123; CHECK-LABEL: func_umin_fore_zero_u16:
124; CHECK:       # %bb.0:
125; CHECK-NEXT:    or %s0, 0, (0)1
126; CHECK-NEXT:    b.l.t (, %s10)
127  ret i16 0
128}
129
130; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
131define zeroext i32 @func_umin_fore_zero_u32(i32 noundef zeroext %0) {
132; CHECK-LABEL: func_umin_fore_zero_u32:
133; CHECK:       # %bb.0:
134; CHECK-NEXT:    or %s0, 0, (0)1
135; CHECK-NEXT:    b.l.t (, %s10)
136  ret i32 0
137}
138
139; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
140define i64 @func_umin_fore_zero_u64(i64 noundef %0) {
141; CHECK-LABEL: func_umin_fore_zero_u64:
142; CHECK:       # %bb.0:
143; CHECK-NEXT:    or %s0, 0, (0)1
144; CHECK-NEXT:    b.l.t (, %s10)
145  ret i64 0
146}
147
148; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
149define i128 @func_umin_fore_zero_u128(i128 noundef %0) {
150; CHECK-LABEL: func_umin_fore_zero_u128:
151; CHECK:       # %bb.0:
152; CHECK-NEXT:    or %s0, 0, (0)1
153; CHECK-NEXT:    or %s1, 0, (0)1
154; CHECK-NEXT:    b.l.t (, %s10)
155  ret i128 0
156}
157
158; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
159define zeroext i1 @func_umin_back_zero_i1(i1 noundef zeroext %0) {
160; CHECK-LABEL: func_umin_back_zero_i1:
161; CHECK:       # %bb.0:
162; CHECK-NEXT:    or %s0, 0, (0)1
163; CHECK-NEXT:    b.l.t (, %s10)
164  ret i1 false
165}
166
167; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
168define zeroext i8 @func_umin_back_zero_u8(i8 noundef zeroext %0) {
169; CHECK-LABEL: func_umin_back_zero_u8:
170; CHECK:       # %bb.0:
171; CHECK-NEXT:    or %s0, 0, (0)1
172; CHECK-NEXT:    b.l.t (, %s10)
173  ret i8 0
174}
175
176; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
177define zeroext i16 @func_umin_back_zero_u16(i16 noundef zeroext %0) {
178; CHECK-LABEL: func_umin_back_zero_u16:
179; CHECK:       # %bb.0:
180; CHECK-NEXT:    or %s0, 0, (0)1
181; CHECK-NEXT:    b.l.t (, %s10)
182  ret i16 0
183}
184
185; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
186define zeroext i32 @func_umin_back_zero_u32(i32 noundef zeroext %0) {
187; CHECK-LABEL: func_umin_back_zero_u32:
188; CHECK:       # %bb.0:
189; CHECK-NEXT:    or %s0, 0, (0)1
190; CHECK-NEXT:    b.l.t (, %s10)
191  ret i32 0
192}
193
194; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
195define i64 @func_umin_back_zero_u64(i64 noundef %0) {
196; CHECK-LABEL: func_umin_back_zero_u64:
197; CHECK:       # %bb.0:
198; CHECK-NEXT:    or %s0, 0, (0)1
199; CHECK-NEXT:    b.l.t (, %s10)
200  ret i64 0
201}
202
203; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
204define i128 @func_umin_back_zero_u128(i128 noundef %0) {
205; CHECK-LABEL: func_umin_back_zero_u128:
206; CHECK:       # %bb.0:
207; CHECK-NEXT:    or %s0, 0, (0)1
208; CHECK-NEXT:    or %s1, 0, (0)1
209; CHECK-NEXT:    b.l.t (, %s10)
210  ret i128 0
211}
212
213; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
214define zeroext i1 @func_umin_fore_const_i1(i1 noundef returned zeroext %0) {
215; CHECK-LABEL: func_umin_fore_const_i1:
216; CHECK:       # %bb.0:
217; CHECK-NEXT:    b.l.t (, %s10)
218  ret i1 %0
219}
220
221; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
222define zeroext i8 @func_umin_fore_const_u8(i8 noundef returned zeroext %0) {
223; CHECK-LABEL: func_umin_fore_const_u8:
224; CHECK:       # %bb.0:
225; CHECK-NEXT:    b.l.t (, %s10)
226  ret i8 %0
227}
228
229; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
230define zeroext i16 @func_umin_fore_const_u16(i16 noundef zeroext %0) {
231; CHECK-LABEL: func_umin_fore_const_u16:
232; CHECK:       # %bb.0:
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)
237  ret i16 %2
238}
239
240; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
241define zeroext i32 @func_umin_fore_const_u32(i32 noundef zeroext %0) {
242; CHECK-LABEL: func_umin_fore_const_u32:
243; CHECK:       # %bb.0:
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)
249  ret i32 %2
250}
251
252; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
253define i64 @func_umin_fore_const_u64(i64 noundef %0) {
254; CHECK-LABEL: func_umin_fore_const_u64:
255; CHECK:       # %bb.0:
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)
260  ret i64 %2
261}
262
263; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
264define i128 @func_umin_fore_const_u128(i128 noundef %0) {
265; CHECK-LABEL: func_umin_fore_const_u128:
266; CHECK:       # %bb.0:
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)
273  ret i128 %2
274}
275
276; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
277define zeroext i1 @func_umin_back_const_i1(i1 noundef returned zeroext %0) {
278; CHECK-LABEL: func_umin_back_const_i1:
279; CHECK:       # %bb.0:
280; CHECK-NEXT:    b.l.t (, %s10)
281  ret i1 %0
282}
283
284; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
285define zeroext i8 @func_umin_back_const_u8(i8 noundef returned zeroext %0) {
286; CHECK-LABEL: func_umin_back_const_u8:
287; CHECK:       # %bb.0:
288; CHECK-NEXT:    b.l.t (, %s10)
289  ret i8 %0
290}
291
292; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
293define zeroext i16 @func_umin_back_const_u16(i16 noundef zeroext %0) {
294; CHECK-LABEL: func_umin_back_const_u16:
295; CHECK:       # %bb.0:
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)
300  ret i16 %2
301}
302
303; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
304define zeroext i32 @func_umin_back_const_u32(i32 noundef zeroext %0) {
305; CHECK-LABEL: func_umin_back_const_u32:
306; CHECK:       # %bb.0:
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)
312  ret i32 %2
313}
314
315; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
316define i64 @func_umin_back_const_u64(i64 noundef %0) {
317; CHECK-LABEL: func_umin_back_const_u64:
318; CHECK:       # %bb.0:
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)
323  ret i64 %2
324}
325
326; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
327define i128 @func_umin_back_const_u128(i128 noundef %0) {
328; CHECK-LABEL: func_umin_back_const_u128:
329; CHECK:       # %bb.0:
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)
336  ret i128 %2
337}
338
339; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
340declare i32 @llvm.umin.i32(i32, i32)
341
342; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
343declare i1 @llvm.umin.i1(i1, i1)
344
345; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
346declare i8 @llvm.umin.i8(i8, i8)
347
348; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
349declare i16 @llvm.umin.i16(i16, i16)
350
351; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
352declare i64 @llvm.umin.i64(i64, i64)
353
354; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
355declare i128 @llvm.umin.i128(i128, i128)
356