468 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; FIXME: fmaximumnum/fminimumnum have no vectorizing support yet.3; RUN: opt --passes=loop-vectorize --mtriple=x86_64 -S < %s | FileCheck %s4 5define void @fmin32(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {6; CHECK-LABEL: define void @fmin32(7; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {8; CHECK-NEXT: [[ENTRY:.*:]]9; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i6410; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i6411; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i6412; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]13; CHECK: [[VECTOR_MEMCHECK]]:14; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]15; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 3216; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]17; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 3218; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]19; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]20; CHECK: [[VECTOR_PH]]:21; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]22; CHECK: [[VECTOR_BODY]]:23; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]24; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT1]], i64 0, i64 [[INDEX]]25; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw float, ptr [[TMP2]], i64 426; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 427; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP4]], align 428; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT2]], i64 0, i64 [[INDEX]]29; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw float, ptr [[TMP5]], i64 430; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP5]], align 431; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, ptr [[TMP7]], align 432; CHECK-NEXT: [[TMP8:%.*]] = call <4 x float> @llvm.minimumnum.v4f32(<4 x float> [[WIDE_LOAD]], <4 x float> [[WIDE_LOAD6]])33; CHECK-NEXT: [[TMP9:%.*]] = call <4 x float> @llvm.minimumnum.v4f32(<4 x float> [[WIDE_LOAD5]], <4 x float> [[WIDE_LOAD7]])34; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]35; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw float, ptr [[TMP10]], i64 436; CHECK-NEXT: store <4 x float> [[TMP8]], ptr [[TMP10]], align 437; CHECK-NEXT: store <4 x float> [[TMP9]], ptr [[TMP12]], align 438; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 839; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i64 [[INDEX_NEXT]], 409640; CHECK-NEXT: br i1 [[TMP13]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]41; CHECK: [[MIDDLE_BLOCK]]:42; CHECK-NEXT: br label %[[EXIT:.*]]43; CHECK: [[SCALAR_PH]]:44; CHECK-NEXT: br label %[[FOR_BODY:.*]]45; CHECK: [[FOR_BODY]]:46; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]47; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]48; CHECK-NEXT: [[IN1:%.*]] = load float, ptr [[ARRAYIDX]], align 449; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]50; CHECK-NEXT: [[IN2:%.*]] = load float, ptr [[ARRAYIDX2]], align 451; CHECK-NEXT: [[OUT:%.*]] = tail call float @llvm.minimumnum.f32(float [[IN1]], float [[IN2]])52; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]53; CHECK-NEXT: store float [[OUT]], ptr [[ARRAYIDX4]], align 454; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 155; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 409656; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]]57; CHECK: [[EXIT]]:58; CHECK-NEXT: ret void59;60entry:61 br label %for.body62 63for.body:64 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]65 %arrayidx = getelementptr inbounds nuw [4096 x float], ptr %input1, i64 0, i64 %iv66 %in1 = load float, ptr %arrayidx, align 467 %arrayidx2 = getelementptr inbounds nuw [4096 x float], ptr %input2, i64 0, i64 %iv68 %in2 = load float, ptr %arrayidx2, align 469 %out = tail call float @llvm.minimumnum.f32(float %in1, float %in2)70 %arrayidx4 = getelementptr inbounds nuw [4096 x float], ptr %output, i64 0, i64 %iv71 store float %out, ptr %arrayidx4, align 472 %iv.next = add nuw nsw i64 %iv, 173 %exitcond.not = icmp eq i64 %iv.next, 409674 br i1 %exitcond.not, label %exit, label %for.body75 76exit:77 ret void78}79 80declare float @llvm.minimumnum.f32(float, float)81 82define void @fmax32(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {83; CHECK-LABEL: define void @fmax32(84; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {85; CHECK-NEXT: [[ENTRY:.*:]]86; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i6487; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i6488; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i6489; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]90; CHECK: [[VECTOR_MEMCHECK]]:91; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]92; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 3293; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]94; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 3295; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]96; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]97; CHECK: [[VECTOR_PH]]:98; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]99; CHECK: [[VECTOR_BODY]]:100; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]101; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT1]], i64 0, i64 [[INDEX]]102; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw float, ptr [[TMP2]], i64 4103; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4104; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP4]], align 4105; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT2]], i64 0, i64 [[INDEX]]106; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw float, ptr [[TMP5]], i64 4107; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP5]], align 4108; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, ptr [[TMP7]], align 4109; CHECK-NEXT: [[TMP8:%.*]] = call <4 x float> @llvm.maximumnum.v4f32(<4 x float> [[WIDE_LOAD]], <4 x float> [[WIDE_LOAD6]])110; CHECK-NEXT: [[TMP9:%.*]] = call <4 x float> @llvm.maximumnum.v4f32(<4 x float> [[WIDE_LOAD5]], <4 x float> [[WIDE_LOAD7]])111; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]112; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw float, ptr [[TMP10]], i64 4113; CHECK-NEXT: store <4 x float> [[TMP8]], ptr [[TMP10]], align 4114; CHECK-NEXT: store <4 x float> [[TMP9]], ptr [[TMP12]], align 4115; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8116; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096117; CHECK-NEXT: br i1 [[TMP13]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]118; CHECK: [[MIDDLE_BLOCK]]:119; CHECK-NEXT: br label %[[EXIT:.*]]120; CHECK: [[SCALAR_PH]]:121; CHECK-NEXT: br label %[[FOR_BODY:.*]]122; CHECK: [[FOR_BODY]]:123; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]124; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]125; CHECK-NEXT: [[IN1:%.*]] = load float, ptr [[ARRAYIDX]], align 4126; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]127; CHECK-NEXT: [[IN2:%.*]] = load float, ptr [[ARRAYIDX2]], align 4128; CHECK-NEXT: [[OUT:%.*]] = tail call float @llvm.maximumnum.f32(float [[IN1]], float [[IN2]])129; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x float], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]130; CHECK-NEXT: store float [[OUT]], ptr [[ARRAYIDX4]], align 4131; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1132; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4096133; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]134; CHECK: [[EXIT]]:135; CHECK-NEXT: ret void136;137entry:138 br label %for.body139 140for.body:141 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]142 %arrayidx = getelementptr inbounds nuw [4096 x float], ptr %input1, i64 0, i64 %iv143 %in1 = load float, ptr %arrayidx, align 4144 %arrayidx2 = getelementptr inbounds nuw [4096 x float], ptr %input2, i64 0, i64 %iv145 %in2 = load float, ptr %arrayidx2, align 4146 %out = tail call float @llvm.maximumnum.f32(float %in1, float %in2)147 %arrayidx4 = getelementptr inbounds nuw [4096 x float], ptr %output, i64 0, i64 %iv148 store float %out, ptr %arrayidx4, align 4149 %iv.next = add nuw nsw i64 %iv, 1150 %exitcond.not = icmp eq i64 %iv.next, 4096151 br i1 %exitcond.not, label %exit, label %for.body152 153exit:154 ret void155}156 157declare float @llvm.maximumnum.f32(float, float)158 159define void @fmin64(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {160; CHECK-LABEL: define void @fmin64(161; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {162; CHECK-NEXT: [[ENTRY:.*:]]163; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i64164; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i64165; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i64166; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]167; CHECK: [[VECTOR_MEMCHECK]]:168; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]169; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 32170; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]171; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 32172; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]173; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]174; CHECK: [[VECTOR_PH]]:175; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]176; CHECK: [[VECTOR_BODY]]:177; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]178; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT1]], i64 0, i64 [[INDEX]]179; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw double, ptr [[TMP2]], i64 2180; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <2 x double>, ptr [[TMP2]], align 8181; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <2 x double>, ptr [[TMP4]], align 8182; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT2]], i64 0, i64 [[INDEX]]183; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw double, ptr [[TMP5]], i64 2184; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <2 x double>, ptr [[TMP5]], align 8185; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <2 x double>, ptr [[TMP7]], align 8186; CHECK-NEXT: [[TMP8:%.*]] = call <2 x double> @llvm.minimumnum.v2f64(<2 x double> [[WIDE_LOAD]], <2 x double> [[WIDE_LOAD6]])187; CHECK-NEXT: [[TMP9:%.*]] = call <2 x double> @llvm.minimumnum.v2f64(<2 x double> [[WIDE_LOAD5]], <2 x double> [[WIDE_LOAD7]])188; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]189; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw double, ptr [[TMP10]], i64 2190; CHECK-NEXT: store <2 x double> [[TMP8]], ptr [[TMP10]], align 8191; CHECK-NEXT: store <2 x double> [[TMP9]], ptr [[TMP12]], align 8192; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4193; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096194; CHECK-NEXT: br i1 [[TMP13]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]195; CHECK: [[MIDDLE_BLOCK]]:196; CHECK-NEXT: br label %[[EXIT:.*]]197; CHECK: [[SCALAR_PH]]:198; CHECK-NEXT: br label %[[FOR_BODY:.*]]199; CHECK: [[FOR_BODY]]:200; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]201; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]202; CHECK-NEXT: [[IN1:%.*]] = load double, ptr [[ARRAYIDX]], align 8203; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]204; CHECK-NEXT: [[IN2:%.*]] = load double, ptr [[ARRAYIDX2]], align 8205; CHECK-NEXT: [[OUT:%.*]] = tail call double @llvm.minimumnum.f64(double [[IN1]], double [[IN2]])206; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]207; CHECK-NEXT: store double [[OUT]], ptr [[ARRAYIDX4]], align 8208; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1209; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4096210; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]]211; CHECK: [[EXIT]]:212; CHECK-NEXT: ret void213;214entry:215 br label %for.body216 217for.body:218 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]219 %arrayidx = getelementptr inbounds nuw [4096 x double], ptr %input1, i64 0, i64 %iv220 %in1 = load double, ptr %arrayidx, align 8221 %arrayidx2 = getelementptr inbounds nuw [4096 x double], ptr %input2, i64 0, i64 %iv222 %in2 = load double, ptr %arrayidx2, align 8223 %out = tail call double @llvm.minimumnum.f64(double %in1, double %in2)224 %arrayidx4 = getelementptr inbounds nuw [4096 x double], ptr %output, i64 0, i64 %iv225 store double %out, ptr %arrayidx4, align 8226 %iv.next = add nuw nsw i64 %iv, 1227 %exitcond.not = icmp eq i64 %iv.next, 4096228 br i1 %exitcond.not, label %exit, label %for.body229 230exit:231 ret void232}233 234declare double @llvm.minimumnum.f64(double, double)235 236define void @fmax64(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {237; CHECK-LABEL: define void @fmax64(238; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {239; CHECK-NEXT: [[ENTRY:.*:]]240; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i64241; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i64242; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i64243; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]244; CHECK: [[VECTOR_MEMCHECK]]:245; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]246; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 32247; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]248; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 32249; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]250; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]251; CHECK: [[VECTOR_PH]]:252; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]253; CHECK: [[VECTOR_BODY]]:254; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]255; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT1]], i64 0, i64 [[INDEX]]256; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw double, ptr [[TMP2]], i64 2257; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <2 x double>, ptr [[TMP2]], align 8258; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <2 x double>, ptr [[TMP4]], align 8259; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT2]], i64 0, i64 [[INDEX]]260; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw double, ptr [[TMP5]], i64 2261; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <2 x double>, ptr [[TMP5]], align 8262; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <2 x double>, ptr [[TMP7]], align 8263; CHECK-NEXT: [[TMP8:%.*]] = call <2 x double> @llvm.maximumnum.v2f64(<2 x double> [[WIDE_LOAD]], <2 x double> [[WIDE_LOAD6]])264; CHECK-NEXT: [[TMP9:%.*]] = call <2 x double> @llvm.maximumnum.v2f64(<2 x double> [[WIDE_LOAD5]], <2 x double> [[WIDE_LOAD7]])265; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]266; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw double, ptr [[TMP10]], i64 2267; CHECK-NEXT: store <2 x double> [[TMP8]], ptr [[TMP10]], align 8268; CHECK-NEXT: store <2 x double> [[TMP9]], ptr [[TMP12]], align 8269; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4270; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096271; CHECK-NEXT: br i1 [[TMP13]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]272; CHECK: [[MIDDLE_BLOCK]]:273; CHECK-NEXT: br label %[[EXIT:.*]]274; CHECK: [[SCALAR_PH]]:275; CHECK-NEXT: br label %[[FOR_BODY:.*]]276; CHECK: [[FOR_BODY]]:277; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]278; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]279; CHECK-NEXT: [[IN1:%.*]] = load double, ptr [[ARRAYIDX]], align 8280; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]281; CHECK-NEXT: [[IN2:%.*]] = load double, ptr [[ARRAYIDX2]], align 8282; CHECK-NEXT: [[OUT:%.*]] = tail call double @llvm.maximumnum.f64(double [[IN1]], double [[IN2]])283; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x double], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]284; CHECK-NEXT: store double [[OUT]], ptr [[ARRAYIDX4]], align 8285; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1286; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4096287; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP9:![0-9]+]]288; CHECK: [[EXIT]]:289; CHECK-NEXT: ret void290;291entry:292 br label %for.body293 294for.body:295 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]296 %arrayidx = getelementptr inbounds nuw [4096 x double], ptr %input1, i64 0, i64 %iv297 %in1 = load double, ptr %arrayidx, align 8298 %arrayidx2 = getelementptr inbounds nuw [4096 x double], ptr %input2, i64 0, i64 %iv299 %in2 = load double, ptr %arrayidx2, align 8300 %out = tail call double @llvm.maximumnum.f64(double %in1, double %in2)301 %arrayidx4 = getelementptr inbounds nuw [4096 x double], ptr %output, i64 0, i64 %iv302 store double %out, ptr %arrayidx4, align 8303 %iv.next = add nuw nsw i64 %iv, 1304 %exitcond.not = icmp eq i64 %iv.next, 4096305 br i1 %exitcond.not, label %exit, label %for.body306 307exit:308 ret void309}310 311declare double @llvm.maximumnum.f64(double, double)312 313define void @fmin16(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {314; CHECK-LABEL: define void @fmin16(315; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {316; CHECK-NEXT: [[ENTRY:.*:]]317; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i64318; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i64319; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i64320; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]321; CHECK: [[VECTOR_MEMCHECK]]:322; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]323; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 16324; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]325; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 16326; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]327; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]328; CHECK: [[VECTOR_PH]]:329; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]330; CHECK: [[VECTOR_BODY]]:331; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]332; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT1]], i64 0, i64 [[INDEX]]333; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x half>, ptr [[TMP2]], align 2334; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT2]], i64 0, i64 [[INDEX]]335; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <8 x half>, ptr [[TMP4]], align 2336; CHECK-NEXT: [[TMP6:%.*]] = call <8 x half> @llvm.minimumnum.v8f16(<8 x half> [[WIDE_LOAD]], <8 x half> [[WIDE_LOAD5]])337; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]338; CHECK-NEXT: store <8 x half> [[TMP6]], ptr [[TMP7]], align 2339; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8340; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096341; CHECK-NEXT: br i1 [[TMP9]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]]342; CHECK: [[MIDDLE_BLOCK]]:343; CHECK-NEXT: br label %[[EXIT:.*]]344; CHECK: [[SCALAR_PH]]:345; CHECK-NEXT: br label %[[FOR_BODY:.*]]346; CHECK: [[FOR_BODY]]:347; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]348; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]349; CHECK-NEXT: [[IN1:%.*]] = load half, ptr [[ARRAYIDX]], align 2350; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]351; CHECK-NEXT: [[IN2:%.*]] = load half, ptr [[ARRAYIDX2]], align 2352; CHECK-NEXT: [[OUT:%.*]] = tail call half @llvm.minimumnum.f16(half [[IN1]], half [[IN2]])353; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]354; CHECK-NEXT: store half [[OUT]], ptr [[ARRAYIDX4]], align 2355; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1356; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4096357; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]]358; CHECK: [[EXIT]]:359; CHECK-NEXT: ret void360;361entry:362 br label %for.body363 364for.body:365 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]366 %arrayidx = getelementptr inbounds nuw [4096 x half], ptr %input1, i64 0, i64 %iv367 %in1 = load half, ptr %arrayidx, align 2368 %arrayidx2 = getelementptr inbounds nuw [4096 x half], ptr %input2, i64 0, i64 %iv369 %in2 = load half, ptr %arrayidx2, align 2370 %out = tail call half @llvm.minimumnum.f16(half %in1, half %in2)371 %arrayidx4 = getelementptr inbounds nuw [4096 x half], ptr %output, i64 0, i64 %iv372 store half %out, ptr %arrayidx4, align 2373 %iv.next = add nuw nsw i64 %iv, 1374 %exitcond.not = icmp eq i64 %iv.next, 4096375 br i1 %exitcond.not, label %exit, label %for.body376 377exit:378 ret void379}380 381declare half @llvm.minimumnum.f16(half, half)382 383define void @fmax16(ptr noundef readonly captures(none) %input1, ptr noundef readonly captures(none) %input2, ptr noundef writeonly captures(none) %output) {384; CHECK-LABEL: define void @fmax16(385; CHECK-SAME: ptr noundef readonly captures(none) [[INPUT1:%.*]], ptr noundef readonly captures(none) [[INPUT2:%.*]], ptr noundef writeonly captures(none) [[OUTPUT:%.*]]) {386; CHECK-NEXT: [[ENTRY:.*:]]387; CHECK-NEXT: [[INPUT23:%.*]] = ptrtoint ptr [[INPUT2]] to i64388; CHECK-NEXT: [[INPUT12:%.*]] = ptrtoint ptr [[INPUT1]] to i64389; CHECK-NEXT: [[OUTPUT1:%.*]] = ptrtoint ptr [[OUTPUT]] to i64390; CHECK-NEXT: br label %[[VECTOR_MEMCHECK:.*]]391; CHECK: [[VECTOR_MEMCHECK]]:392; CHECK-NEXT: [[TMP0:%.*]] = sub i64 [[OUTPUT1]], [[INPUT12]]393; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP0]], 16394; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[OUTPUT1]], [[INPUT23]]395; CHECK-NEXT: [[DIFF_CHECK4:%.*]] = icmp ult i64 [[TMP1]], 16396; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]397; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]398; CHECK: [[VECTOR_PH]]:399; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]400; CHECK: [[VECTOR_BODY]]:401; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]402; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT1]], i64 0, i64 [[INDEX]]403; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x half>, ptr [[TMP2]], align 2404; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT2]], i64 0, i64 [[INDEX]]405; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <8 x half>, ptr [[TMP4]], align 2406; CHECK-NEXT: [[TMP6:%.*]] = call <8 x half> @llvm.maximumnum.v8f16(<8 x half> [[WIDE_LOAD]], <8 x half> [[WIDE_LOAD5]])407; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[OUTPUT]], i64 0, i64 [[INDEX]]408; CHECK-NEXT: store <8 x half> [[TMP6]], ptr [[TMP7]], align 2409; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8410; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096411; CHECK-NEXT: br i1 [[TMP9]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]]412; CHECK: [[MIDDLE_BLOCK]]:413; CHECK-NEXT: br label %[[EXIT:.*]]414; CHECK: [[SCALAR_PH]]:415; CHECK-NEXT: br label %[[FOR_BODY:.*]]416; CHECK: [[FOR_BODY]]:417; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]418; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT1]], i64 0, i64 [[INDVARS_IV]]419; CHECK-NEXT: [[IN1:%.*]] = load half, ptr [[ARRAYIDX]], align 2420; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[INPUT2]], i64 0, i64 [[INDVARS_IV]]421; CHECK-NEXT: [[IN2:%.*]] = load half, ptr [[ARRAYIDX2]], align 2422; CHECK-NEXT: [[OUT:%.*]] = tail call half @llvm.maximumnum.f16(half [[IN1]], half [[IN2]])423; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw [4096 x half], ptr [[OUTPUT]], i64 0, i64 [[INDVARS_IV]]424; CHECK-NEXT: store half [[OUT]], ptr [[ARRAYIDX4]], align 2425; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1426; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4096427; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label %[[EXIT]], label %[[FOR_BODY]], !llvm.loop [[LOOP13:![0-9]+]]428; CHECK: [[EXIT]]:429; CHECK-NEXT: ret void430;431entry:432 br label %for.body433 434for.body:435 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]436 %arrayidx = getelementptr inbounds nuw [4096 x half], ptr %input1, i64 0, i64 %iv437 %in1 = load half, ptr %arrayidx, align 2438 %arrayidx2 = getelementptr inbounds nuw [4096 x half], ptr %input2, i64 0, i64 %iv439 %in2 = load half, ptr %arrayidx2, align 2440 %out = tail call half @llvm.maximumnum.f16(half %in1, half %in2)441 %arrayidx4 = getelementptr inbounds nuw [4096 x half], ptr %output, i64 0, i64 %iv442 store half %out, ptr %arrayidx4, align 2443 %iv.next = add nuw nsw i64 %iv, 1444 %exitcond.not = icmp eq i64 %iv.next, 4096445 br i1 %exitcond.not, label %exit, label %for.body446 447exit:448 ret void449}450 451declare half @llvm.maximumnum.f16(half, half)452;.453; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]]}454; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}455; CHECK: [[META2]] = !{!"llvm.loop.unroll.runtime.disable"}456; CHECK: [[LOOP3]] = distinct !{[[LOOP3]], [[META1]]}457; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META1]], [[META2]]}458; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]]}459; CHECK: [[LOOP6]] = distinct !{[[LOOP6]], [[META1]], [[META2]]}460; CHECK: [[LOOP7]] = distinct !{[[LOOP7]], [[META1]]}461; CHECK: [[LOOP8]] = distinct !{[[LOOP8]], [[META1]], [[META2]]}462; CHECK: [[LOOP9]] = distinct !{[[LOOP9]], [[META1]]}463; CHECK: [[LOOP10]] = distinct !{[[LOOP10]], [[META1]], [[META2]]}464; CHECK: [[LOOP11]] = distinct !{[[LOOP11]], [[META1]]}465; CHECK: [[LOOP12]] = distinct !{[[LOOP12]], [[META1]], [[META2]]}466; CHECK: [[LOOP13]] = distinct !{[[LOOP13]], [[META1]]}467;.468