350 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 22; RUN: llc < %s -mtriple=ve | FileCheck %s3 4;;; Test ‘llvm.umax.*’ intrinsic5;;;6;;; Syntax:7;;; This is an overloaded intrinsic. You can use @llvm.umax on any8;;; integer bit width or any vector of integer elements.9;;;10;;; declare i32 @llvm.umax.i32(i32 %a, i32 %b)11;;; declare <4 x i32> @llvm.umax.v4i32(<4 x i32> %a, <4 x i32> %b)12;;;13;;; Overview:14;;; Return the larger of %a and %b comparing the values as unsigned15;;; integers. Vector intrinsics operate on a per-element basis. The16;;; larger element of %a and %b at a given index is returned for17;;; that index.18;;;19;;; Arguments:20;;; The arguments (%a and %b) may be of any integer type or a vector21;;; with integer element type. The argument types must match each22;;; 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 willreturn28define zeroext i1 @func_umax_var_i1(i1 noundef zeroext %0, i1 noundef zeroext %1) {29; CHECK-LABEL: func_umax_var_i1:30; CHECK: # %bb.0:31; CHECK-NEXT: or %s0, %s0, %s132; CHECK-NEXT: b.l.t (, %s10)33 %3 = tail call i1 @llvm.umax.i1(i1 %0, i1 %1)34 ret i1 %335}36 37; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn38define zeroext i8 @func_umax_var_u8(i8 noundef zeroext %0, i8 noundef zeroext %1) {39; CHECK-LABEL: func_umax_var_u8:40; CHECK: # %bb.0:41; CHECK-NEXT: maxs.w.sx %s0, %s0, %s142; CHECK-NEXT: adds.w.zx %s0, %s0, (0)143; CHECK-NEXT: b.l.t (, %s10)44 %3 = tail call i8 @llvm.umax.i8(i8 %0, i8 %1)45 ret i8 %346}47 48; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn49define zeroext i16 @func_umax_var_u16(i16 noundef zeroext %0, i16 noundef zeroext %1) {50; CHECK-LABEL: func_umax_var_u16:51; CHECK: # %bb.0:52; CHECK-NEXT: maxs.w.sx %s0, %s0, %s153; CHECK-NEXT: adds.w.zx %s0, %s0, (0)154; CHECK-NEXT: b.l.t (, %s10)55 %3 = tail call i16 @llvm.umax.i16(i16 %0, i16 %1)56 ret i16 %357}58 59; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn60define zeroext i32 @func_umax_var_u32(i32 noundef zeroext %0, i32 noundef zeroext %1) {61; CHECK-LABEL: func_umax_var_u32:62; CHECK: # %bb.0:63; CHECK-NEXT: cmpu.w %s2, %s0, %s164; CHECK-NEXT: cmov.w.gt %s1, %s0, %s265; CHECK-NEXT: adds.w.zx %s0, %s1, (0)166; CHECK-NEXT: b.l.t (, %s10)67 %3 = tail call i32 @llvm.umax.i32(i32 %0, i32 %1)68 ret i32 %369}70 71; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn72define i64 @func_umax_var_u64(i64 noundef %0, i64 noundef %1) {73; CHECK-LABEL: func_umax_var_u64:74; CHECK: # %bb.0:75; CHECK-NEXT: cmpu.l %s2, %s0, %s176; CHECK-NEXT: cmov.l.gt %s1, %s0, %s277; CHECK-NEXT: or %s0, 0, %s178; CHECK-NEXT: b.l.t (, %s10)79 %3 = tail call i64 @llvm.umax.i64(i64 %0, i64 %1)80 ret i64 %381}82 83; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn84define i128 @func_umax_var_u128(i128 noundef %0, i128 noundef %1) {85; CHECK-LABEL: func_umax_var_u128:86; CHECK: # %bb.0:87; CHECK-NEXT: cmpu.l %s4, %s1, %s388; CHECK-NEXT: or %s5, 0, (0)189; CHECK-NEXT: or %s6, 0, (0)190; CHECK-NEXT: cmov.l.gt %s6, (63)0, %s491; CHECK-NEXT: cmpu.l %s7, %s0, %s292; CHECK-NEXT: cmov.l.gt %s5, (63)0, %s793; CHECK-NEXT: cmov.l.eq %s6, %s5, %s494; CHECK-NEXT: cmov.w.ne %s2, %s0, %s695; CHECK-NEXT: cmov.w.ne %s3, %s1, %s696; CHECK-NEXT: or %s0, 0, %s297; CHECK-NEXT: or %s1, 0, %s398; CHECK-NEXT: b.l.t (, %s10)99 %3 = tail call i128 @llvm.umax.i128(i128 %0, i128 %1)100 ret i128 %3101}102 103; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn104define zeroext i1 @func_umax_fore_zero_i1(i1 noundef returned zeroext %0) {105; CHECK-LABEL: func_umax_fore_zero_i1:106; CHECK: # %bb.0:107; CHECK-NEXT: b.l.t (, %s10)108 ret i1 %0109}110 111; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn112define zeroext i8 @func_umax_fore_zero_u8(i8 noundef returned zeroext %0) {113; CHECK-LABEL: func_umax_fore_zero_u8:114; CHECK: # %bb.0:115; CHECK-NEXT: b.l.t (, %s10)116 ret i8 %0117}118 119; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn120define zeroext i16 @func_umax_fore_zero_u16(i16 noundef returned zeroext %0) {121; CHECK-LABEL: func_umax_fore_zero_u16:122; CHECK: # %bb.0:123; CHECK-NEXT: b.l.t (, %s10)124 ret i16 %0125}126 127; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn128define zeroext i32 @func_umax_fore_zero_u32(i32 noundef returned zeroext %0) {129; CHECK-LABEL: func_umax_fore_zero_u32:130; CHECK: # %bb.0:131; CHECK-NEXT: b.l.t (, %s10)132 ret i32 %0133}134 135; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn136define i64 @func_umax_fore_zero_u64(i64 noundef returned %0) {137; CHECK-LABEL: func_umax_fore_zero_u64:138; CHECK: # %bb.0:139; CHECK-NEXT: b.l.t (, %s10)140 ret i64 %0141}142 143; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn144define i128 @func_umax_fore_zero_u128(i128 noundef returned %0) {145; CHECK-LABEL: func_umax_fore_zero_u128:146; CHECK: # %bb.0:147; CHECK-NEXT: b.l.t (, %s10)148 ret i128 %0149}150 151; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn152define zeroext i1 @func_umax_back_zero_i1(i1 noundef returned zeroext %0) {153; CHECK-LABEL: func_umax_back_zero_i1:154; CHECK: # %bb.0:155; CHECK-NEXT: b.l.t (, %s10)156 ret i1 %0157}158 159; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn160define zeroext i8 @func_umax_back_zero_u8(i8 noundef returned zeroext %0) {161; CHECK-LABEL: func_umax_back_zero_u8:162; CHECK: # %bb.0:163; CHECK-NEXT: b.l.t (, %s10)164 ret i8 %0165}166 167; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn168define zeroext i16 @func_umax_back_zero_u16(i16 noundef returned zeroext %0) {169; CHECK-LABEL: func_umax_back_zero_u16:170; CHECK: # %bb.0:171; CHECK-NEXT: b.l.t (, %s10)172 ret i16 %0173}174 175; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn176define zeroext i32 @func_umax_back_zero_u32(i32 noundef returned zeroext %0) {177; CHECK-LABEL: func_umax_back_zero_u32:178; CHECK: # %bb.0:179; CHECK-NEXT: b.l.t (, %s10)180 ret i32 %0181}182 183; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn184define i64 @func_umax_back_zero_u64(i64 noundef returned %0) {185; CHECK-LABEL: func_umax_back_zero_u64:186; CHECK: # %bb.0:187; CHECK-NEXT: b.l.t (, %s10)188 ret i64 %0189}190 191; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn192define i128 @func_umax_back_zero_u128(i128 noundef returned %0) {193; CHECK-LABEL: func_umax_back_zero_u128:194; CHECK: # %bb.0:195; CHECK-NEXT: b.l.t (, %s10)196 ret i128 %0197}198 199; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn200define zeroext i1 @func_umax_fore_const_i1(i1 noundef zeroext %0) {201; CHECK-LABEL: func_umax_fore_const_i1:202; CHECK: # %bb.0:203; CHECK-NEXT: or %s0, 1, (0)1204; CHECK-NEXT: b.l.t (, %s10)205 ret i1 true206}207 208; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn209define zeroext i8 @func_umax_fore_const_u8(i8 noundef zeroext %0) {210; CHECK-LABEL: func_umax_fore_const_u8:211; CHECK: # %bb.0:212; CHECK-NEXT: lea %s0, 255213; CHECK-NEXT: b.l.t (, %s10)214 ret i8 -1215}216 217; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn218define zeroext i16 @func_umax_fore_const_u16(i16 noundef zeroext %0) {219; CHECK-LABEL: func_umax_fore_const_u16:220; CHECK: # %bb.0:221; CHECK-NEXT: maxs.w.sx %s0, %s0, (56)0222; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1223; CHECK-NEXT: b.l.t (, %s10)224 %2 = tail call i16 @llvm.umax.i16(i16 %0, i16 255)225 ret i16 %2226}227 228; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn229define zeroext i32 @func_umax_fore_const_u32(i32 noundef zeroext %0) {230; CHECK-LABEL: func_umax_fore_const_u32:231; CHECK: # %bb.0:232; CHECK-NEXT: cmpu.w %s1, %s0, (56)0233; CHECK-NEXT: cmov.w.le %s0, (56)0, %s1234; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1235; CHECK-NEXT: b.l.t (, %s10)236 %2 = tail call i32 @llvm.umax.i32(i32 %0, i32 255)237 ret i32 %2238}239 240; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn241define i64 @func_umax_fore_const_u64(i64 noundef %0) {242; CHECK-LABEL: func_umax_fore_const_u64:243; CHECK: # %bb.0:244; CHECK-NEXT: cmpu.l %s1, %s0, (56)0245; CHECK-NEXT: cmov.l.le %s0, (56)0, %s1246; CHECK-NEXT: b.l.t (, %s10)247 %2 = tail call i64 @llvm.umax.i64(i64 %0, i64 255)248 ret i64 %2249}250 251; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn252define i128 @func_umax_fore_const_u128(i128 noundef %0) {253; CHECK-LABEL: func_umax_fore_const_u128:254; CHECK: # %bb.0:255; CHECK-NEXT: or %s2, 0, %s0256; CHECK-NEXT: cmov.l.eq %s2, (56)0, %s1257; CHECK-NEXT: cmpu.l %s3, %s0, (56)0258; CHECK-NEXT: cmov.l.le %s0, (56)0, %s3259; CHECK-NEXT: cmov.l.eq %s2, %s0, %s1260; CHECK-NEXT: or %s0, 0, %s2261; CHECK-NEXT: b.l.t (, %s10)262 %2 = tail call i128 @llvm.umax.i128(i128 %0, i128 255)263 ret i128 %2264}265 266; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn267define zeroext i1 @func_umax_back_const_i1(i1 noundef zeroext %0) {268; CHECK-LABEL: func_umax_back_const_i1:269; CHECK: # %bb.0:270; CHECK-NEXT: or %s0, 1, (0)1271; CHECK-NEXT: b.l.t (, %s10)272 ret i1 true273}274 275; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn276define zeroext i8 @func_umax_back_const_u8(i8 noundef zeroext %0) {277; CHECK-LABEL: func_umax_back_const_u8:278; CHECK: # %bb.0:279; CHECK-NEXT: lea %s0, 255280; CHECK-NEXT: b.l.t (, %s10)281 ret i8 -1282}283 284; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn285define zeroext i16 @func_umax_back_const_u16(i16 noundef zeroext %0) {286; CHECK-LABEL: func_umax_back_const_u16:287; CHECK: # %bb.0:288; CHECK-NEXT: maxs.w.sx %s0, %s0, (56)0289; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1290; CHECK-NEXT: b.l.t (, %s10)291 %2 = tail call i16 @llvm.umax.i16(i16 %0, i16 255)292 ret i16 %2293}294 295; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn296define zeroext i32 @func_umax_back_const_u32(i32 noundef zeroext %0) {297; CHECK-LABEL: func_umax_back_const_u32:298; CHECK: # %bb.0:299; CHECK-NEXT: cmpu.w %s1, %s0, (56)0300; CHECK-NEXT: cmov.w.le %s0, (56)0, %s1301; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1302; CHECK-NEXT: b.l.t (, %s10)303 %2 = tail call i32 @llvm.umax.i32(i32 %0, i32 255)304 ret i32 %2305}306 307; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn308define i64 @func_umax_back_const_u64(i64 noundef %0) {309; CHECK-LABEL: func_umax_back_const_u64:310; CHECK: # %bb.0:311; CHECK-NEXT: cmpu.l %s1, %s0, (56)0312; CHECK-NEXT: cmov.l.le %s0, (56)0, %s1313; CHECK-NEXT: b.l.t (, %s10)314 %2 = tail call i64 @llvm.umax.i64(i64 %0, i64 255)315 ret i64 %2316}317 318; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn319define i128 @func_umax_back_const_u128(i128 noundef %0) {320; CHECK-LABEL: func_umax_back_const_u128:321; CHECK: # %bb.0:322; CHECK-NEXT: or %s2, 0, %s0323; CHECK-NEXT: cmov.l.eq %s2, (56)0, %s1324; CHECK-NEXT: cmpu.l %s3, %s0, (56)0325; CHECK-NEXT: cmov.l.le %s0, (56)0, %s3326; CHECK-NEXT: cmov.l.eq %s2, %s0, %s1327; CHECK-NEXT: or %s0, 0, %s2328; CHECK-NEXT: b.l.t (, %s10)329 %2 = tail call i128 @llvm.umax.i128(i128 %0, i128 255)330 ret i128 %2331}332 333; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn334declare i32 @llvm.umax.i32(i32, i32)335 336; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn337declare i1 @llvm.umax.i1(i1, i1)338 339; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn340declare i8 @llvm.umax.i8(i8, i8)341 342; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn343declare i16 @llvm.umax.i16(i16, i16)344 345; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn346declare i64 @llvm.umax.i64(i64, i64)347 348; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn349declare i128 @llvm.umax.i128(i128, i128)350