327 lines · plain
1; REQUIRES: asserts2; RUN: opt -mattr=+simd128 -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S < %s 2>&1 | FileCheck %s3 4target triple = "wasm32"5 6define hidden i32 @i32_mac_s8(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {7; CHECK-LABEL: 'i32_mac_s8'8; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i8, ptr %arrayidx, align 19; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = sext i8 %0 to i3210; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i8, ptr %arrayidx1, align 111; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = sext i8 %1 to i3212; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nsw i32 %conv2, %conv13 14; CHECK: LV: Found an estimated cost of 3 for VF 2 For instruction: %0 = load i8, ptr %arrayidx, align 115; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv = sext i8 %0 to i3216; CHECK: LV: Found an estimated cost of 3 for VF 2 For instruction: %1 = load i8, ptr %arrayidx1, align 117; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv2 = sext i8 %1 to i3218; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nsw i32 %conv2, %conv19 20; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %0 = load i8, ptr %arrayidx, align 121; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %conv = sext i8 %0 to i3222; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %1 = load i8, ptr %arrayidx1, align 123; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %conv2 = sext i8 %1 to i3224; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %mul = mul nsw i32 %conv2, %conv25; CHECK: LV: Selecting VF: 4.26entry:27 %cmp7.not = icmp eq i32 %N, 028 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body29 30for.cond.cleanup: ; preds = %for.body, %entry31 %res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]32 ret i32 %res.0.lcssa33 34for.body: ; preds = %entry, %for.body35 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]36 %res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]37 %arrayidx = getelementptr inbounds nuw i8, ptr %a, i32 %i.0938 %0 = load i8, ptr %arrayidx, align 139 %conv = sext i8 %0 to i3240 %arrayidx1 = getelementptr inbounds nuw i8, ptr %b, i32 %i.0941 %1 = load i8, ptr %arrayidx1, align 142 %conv2 = sext i8 %1 to i3243 %mul = mul nsw i32 %conv2, %conv44 %add = add nsw i32 %mul, %res.0845 %inc = add nuw i32 %i.09, 146 %exitcond.not = icmp eq i32 %inc, %N47 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body48}49 50define hidden i32 @i32_mac_s16(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {51; CHECK-LABEL: 'i32_mac_s16'52; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i16, ptr %arrayidx, align 253; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = sext i16 %0 to i3254; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i16, ptr %arrayidx1, align 255; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = sext i16 %1 to i3256; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nsw i32 %conv2, %conv57 58; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i16, ptr %arrayidx, align 259; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv = sext i16 %0 to i3260; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i16, ptr %arrayidx1, align 261; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv2 = sext i16 %1 to i3262; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nsw i32 %conv2, %conv63 64; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %0 = load i16, ptr %arrayidx, align 265; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: %conv = sext i16 %0 to i3266; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %1 = load i16, ptr %arrayidx1, align 267; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: %conv2 = sext i16 %1 to i3268; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %mul = mul nsw i32 %conv2, %conv69; CHECK: LV: Selecting VF: 4.70entry:71 %cmp7.not = icmp eq i32 %N, 072 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body73 74for.cond.cleanup: ; preds = %for.body, %entry75 %res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]76 ret i32 %res.0.lcssa77 78for.body: ; preds = %entry, %for.body79 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]80 %res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]81 %arrayidx = getelementptr inbounds nuw i16, ptr %a, i32 %i.0982 %0 = load i16, ptr %arrayidx, align 283 %conv = sext i16 %0 to i3284 %arrayidx1 = getelementptr inbounds nuw i16, ptr %b, i32 %i.0985 %1 = load i16, ptr %arrayidx1, align 286 %conv2 = sext i16 %1 to i3287 %mul = mul nsw i32 %conv2, %conv88 %add = add nsw i32 %mul, %res.0889 %inc = add nuw i32 %i.09, 190 %exitcond.not = icmp eq i32 %inc, %N91 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body92}93 94define hidden i64 @i64_mac_s16(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {95; CHECK-LABEL: 'i64_mac_s16'96; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i16, ptr %arrayidx, align 297; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = sext i16 %0 to i6498; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i16, ptr %arrayidx1, align 299; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = sext i16 %1 to i64100; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nsw i64 %conv2, %conv101 102; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i16, ptr %arrayidx, align 2103; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv = sext i16 %0 to i64104; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i16, ptr %arrayidx1, align 2105; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv2 = sext i16 %1 to i64106; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nsw i64 %conv2, %conv107; CHECK: LV: Selecting VF: 2.108entry:109 %cmp7.not = icmp eq i32 %N, 0110 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body111 112for.cond.cleanup: ; preds = %for.body, %entry113 %res.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]114 ret i64 %res.0.lcssa115 116for.body: ; preds = %entry, %for.body117 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]118 %res.08 = phi i64 [ %add, %for.body ], [ 0, %entry ]119 %arrayidx = getelementptr inbounds nuw i16, ptr %a, i32 %i.09120 %0 = load i16, ptr %arrayidx, align 2121 %conv = sext i16 %0 to i64122 %arrayidx1 = getelementptr inbounds nuw i16, ptr %b, i32 %i.09123 %1 = load i16, ptr %arrayidx1, align 2124 %conv2 = sext i16 %1 to i64125 %mul = mul nsw i64 %conv2, %conv126 %add = add nsw i64 %mul, %res.08127 %inc = add nuw i32 %i.09, 1128 %exitcond.not = icmp eq i32 %inc, %N129 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body130}131 132define hidden i64 @i64_mac_s32(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {133; CHECK-LABEL: 'i64_mac_s32'134; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i32, ptr %arrayidx, align 4135; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i32, ptr %arrayidx1, align 4136; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul i32 %1, %0137; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %conv = sext i32 %mul to i64138 139; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i32, ptr %arrayidx, align 4140; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i32, ptr %arrayidx1, align 4141; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul i32 %1, %0142; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv = sext i32 %mul to i64143; CHECK: LV: Selecting VF: 2.144entry:145 %cmp6.not = icmp eq i32 %N, 0146 br i1 %cmp6.not, label %for.cond.cleanup, label %for.body147 148for.cond.cleanup: ; preds = %for.body, %entry149 %res.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]150 ret i64 %res.0.lcssa151 152for.body: ; preds = %entry, %for.body153 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]154 %res.07 = phi i64 [ %add, %for.body ], [ 0, %entry ]155 %arrayidx = getelementptr inbounds nuw i32, ptr %a, i32 %i.08156 %0 = load i32, ptr %arrayidx, align 4157 %arrayidx1 = getelementptr inbounds nuw i32, ptr %b, i32 %i.08158 %1 = load i32, ptr %arrayidx1, align 4159 %mul = mul i32 %1, %0160 %conv = sext i32 %mul to i64161 %add = add i64 %res.07, %conv162 %inc = add nuw i32 %i.08, 1163 %exitcond.not = icmp eq i32 %inc, %N164 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body165}166 167define hidden i32 @i32_mac_u8(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {168; CHECK-LABEL: 'i32_mac_u8'169; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i8, ptr %arrayidx, align 1170; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = zext i8 %0 to i32171; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i8, ptr %arrayidx1, align 1172; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = zext i8 %1 to i32173; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nuw nsw i32 %conv2, %conv174 175; CHECK: LV: Found an estimated cost of 3 for VF 2 For instruction: %0 = load i8, ptr %arrayidx, align 1176; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv = zext i8 %0 to i32177; CHECK: LV: Found an estimated cost of 3 for VF 2 For instruction: %1 = load i8, ptr %arrayidx1, align 1178; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv2 = zext i8 %1 to i32179; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nuw nsw i32 %conv2, %conv180 181; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %0 = load i8, ptr %arrayidx, align 1182; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %conv = zext i8 %0 to i32183; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %1 = load i8, ptr %arrayidx1, align 1184; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %conv2 = zext i8 %1 to i32185; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %mul = mul nuw nsw i32 %conv2, %conv186; CHECK: LV: Selecting VF: 4.187entry:188 %cmp7.not = icmp eq i32 %N, 0189 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body190 191for.cond.cleanup: ; preds = %for.body, %entry192 %res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]193 ret i32 %res.0.lcssa194 195for.body: ; preds = %entry, %for.body196 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]197 %res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]198 %arrayidx = getelementptr inbounds nuw i8, ptr %a, i32 %i.09199 %0 = load i8, ptr %arrayidx, align 1200 %conv = zext i8 %0 to i32201 %arrayidx1 = getelementptr inbounds nuw i8, ptr %b, i32 %i.09202 %1 = load i8, ptr %arrayidx1, align 1203 %conv2 = zext i8 %1 to i32204 %mul = mul nuw nsw i32 %conv2, %conv205 %add = add i32 %mul, %res.08206 %inc = add nuw i32 %i.09, 1207 %exitcond.not = icmp eq i32 %inc, %N208 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body209}210 211define hidden i32 @i32_mac_u16(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {212; CHECK-LABEL: 'i32_mac_u16'213; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i16, ptr %arrayidx, align 2214; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = zext i16 %0 to i32215; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i16, ptr %arrayidx1, align 2216; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = zext i16 %1 to i32217; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nuw nsw i32 %conv2, %conv218 219; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i16, ptr %arrayidx, align 2220; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv = zext i16 %0 to i32221; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i16, ptr %arrayidx1, align 2222; CHECK: LV: Found an estimated cost of 0 for VF 2 For instruction: %conv2 = zext i16 %1 to i32223; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nuw nsw i32 %conv2, %conv224 225; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %0 = load i16, ptr %arrayidx, align 2226; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: %conv = zext i16 %0 to i32227; CHECK: LV: Found an estimated cost of 2 for VF 4 For instruction: %1 = load i16, ptr %arrayidx1, align 2228; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: %conv2 = zext i16 %1 to i32229; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %mul = mul nuw nsw i32 %conv2, %conv230; CHECK: LV: Selecting VF: 4.231entry:232 %cmp7.not = icmp eq i32 %N, 0233 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body234 235for.cond.cleanup: ; preds = %for.body, %entry236 %res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]237 ret i32 %res.0.lcssa238 239for.body: ; preds = %entry, %for.body240 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]241 %res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]242 %arrayidx = getelementptr inbounds nuw i16, ptr %a, i32 %i.09243 %0 = load i16, ptr %arrayidx, align 2244 %conv = zext i16 %0 to i32245 %arrayidx1 = getelementptr inbounds nuw i16, ptr %b, i32 %i.09246 %1 = load i16, ptr %arrayidx1, align 2247 %conv2 = zext i16 %1 to i32248 %mul = mul nuw nsw i32 %conv2, %conv249 %add = add i32 %mul, %res.08250 %inc = add nuw i32 %i.09, 1251 %exitcond.not = icmp eq i32 %inc, %N252 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body253}254 255define hidden i64 @i64_mac_u16(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {256; CHECK-LABEL: 'i64_mac_u16'257; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i16, ptr %arrayidx, align 2258; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv = zext i16 %0 to i64259; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i16, ptr %arrayidx1, align 2260; CHECK: LV: Found an estimated cost of 0 for VF 1 For instruction: %conv2 = zext i16 %1 to i64261; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nuw nsw i64 %conv2, %conv262 263; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i16, ptr %arrayidx, align 2264; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv = zext i16 %0 to i64265; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i16, ptr %arrayidx1, align 2266; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv2 = zext i16 %1 to i64267; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul nuw nsw i64 %conv2, %conv268; CHECK: LV: Selecting VF: 2.269entry:270 %cmp8.not = icmp eq i32 %N, 0271 br i1 %cmp8.not, label %for.cond.cleanup, label %for.body272 273for.cond.cleanup: ; preds = %for.body, %entry274 %res.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]275 ret i64 %res.0.lcssa276 277for.body: ; preds = %entry, %for.body278 %i.010 = phi i32 [ %inc, %for.body ], [ 0, %entry ]279 %res.09 = phi i64 [ %add, %for.body ], [ 0, %entry ]280 %arrayidx = getelementptr inbounds nuw i16, ptr %a, i32 %i.010281 %0 = load i16, ptr %arrayidx, align 2282 %conv = zext i16 %0 to i64283 %arrayidx1 = getelementptr inbounds nuw i16, ptr %b, i32 %i.010284 %1 = load i16, ptr %arrayidx1, align 2285 %conv2 = zext i16 %1 to i64286 %mul = mul nuw nsw i64 %conv2, %conv287 %add = add i64 %mul, %res.09288 %inc = add nuw i32 %i.010, 1289 %exitcond.not = icmp eq i32 %inc, %N290 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body291}292 293define hidden i64 @i64_mac_u32(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b, i32 noundef %N) {294; CHECK-LABEL: 'i64_mac_u32'295; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i32, ptr %arrayidx, align 4296; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i32, ptr %arrayidx1, align 4297; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul i32 %1, %0298; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %conv = zext i32 %mul to i64299 300; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %0 = load i32, ptr %arrayidx, align 4301; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: %1 = load i32, ptr %arrayidx1, align 4302; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %mul = mul i32 %1, %0303; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %conv = zext i32 %mul to i64304; CHECK: LV: Selecting VF: 2.305entry:306 %cmp6.not = icmp eq i32 %N, 0307 br i1 %cmp6.not, label %for.cond.cleanup, label %for.body308 309for.cond.cleanup: ; preds = %for.body, %entry310 %res.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]311 ret i64 %res.0.lcssa312 313for.body: ; preds = %entry, %for.body314 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]315 %res.07 = phi i64 [ %add, %for.body ], [ 0, %entry ]316 %arrayidx = getelementptr inbounds nuw i32, ptr %a, i32 %i.08317 %0 = load i32, ptr %arrayidx, align 4318 %arrayidx1 = getelementptr inbounds nuw i32, ptr %b, i32 %i.08319 %1 = load i32, ptr %arrayidx1, align 4320 %mul = mul i32 %1, %0321 %conv = zext i32 %mul to i64322 %add = add i64 %res.07, %conv323 %inc = add nuw i32 %i.08, 1324 %exitcond.not = icmp eq i32 %inc, %N325 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body326}327