brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 403fc9f Raw
76 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | FileCheck %s3 4target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"5target triple = "arm64-apple-ios5.0.0"6 7define void @selects_1(ptr nocapture %dst, i32 %A, i32 %B, i32 %C, i32 %N) {8; CHECK: LV: Checking a loop in 'selects_1'9 10; CHECK: Cost of 1 for VF 2: WIDEN-SELECT ir<%cond> = select ir<%cmp1>, ir<10>, ir<%and>11; CHECK: Cost of 1 for VF 2: WIDEN-SELECT ir<%cond6> = select ir<%cmp2>, ir<30>, ir<%and>12; CHECK: Cost of 1 for VF 2: WIDEN-SELECT ir<%cond11> = select ir<%cmp7>, ir<%cond>, ir<%cond6>13 14; CHECK: Cost of 1 for VF 4: WIDEN-SELECT ir<%cond> = select ir<%cmp1>, ir<10>, ir<%and>15; CHECK: Cost of 1 for VF 4: WIDEN-SELECT ir<%cond6> = select ir<%cmp2>, ir<30>, ir<%and>16; CHECK: Cost of 1 for VF 4: WIDEN-SELECT ir<%cond11> = select ir<%cmp7>, ir<%cond>, ir<%cond6>17 18; CHECK: LV: Selecting VF: 419 20entry:21  %cmp26 = icmp sgt i32 %N, 022  br i1 %cmp26, label %for.body.preheader, label %for.cond.cleanup23 24for.body.preheader:                               ; preds = %entry25  %n = zext i32 %N to i6426  br label %for.body27 28for.body:                                         ; preds = %for.body.preheader, %for.body29  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]30  %arrayidx = getelementptr inbounds i32, ptr %dst, i64 %indvars.iv31  %0 = load i32, ptr %arrayidx, align 432  %and = and i32 %0, 204733  %cmp1 = icmp eq i32 %and, %A34  %cond = select i1 %cmp1, i32 10, i32 %and35  %cmp2 = icmp eq i32 %and, %B36  %cond6 = select i1 %cmp2, i32 30, i32 %and37  %cmp7 = icmp ugt i32 %cond, %C38  %cond11 = select i1 %cmp7, i32 %cond, i32 %cond639  store i32 %cond11, ptr %arrayidx, align 440  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 141  %exitcond.not = icmp eq i64 %indvars.iv.next, %n42  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body43 44for.cond.cleanup.loopexit:                        ; preds = %for.body45  br label %for.cond.cleanup46 47for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry48  ret void49}50 51define i32 @multi_user_cmp(ptr readonly %a, i64 noundef %n) {52; CHECK: LV: Checking a loop in 'multi_user_cmp'53; CHECK: Cost of 4 for VF 16: WIDEN ir<%cmp1> = fcmp olt ir<%load1>, ir<0.000000e+00>54; CHECK: LV: Selecting VF: 16.55entry:56  br label %for.body57 58for.body:59  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]60  %all.off.next = phi i1 [ true, %entry ], [ %all.off, %for.body ]61  %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ]62  %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv63  %load1 = load float, ptr %arrayidx, align 464  %cmp1 = fcmp olt float %load1, 0.000000e+0065  %.any.0.off0 = select i1 %cmp1, i1 true, i1 %any.0.off0966  %all.off = select i1 %cmp1, i1 %all.off.next, i1 false67  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 168  %exitcond.not = icmp eq i64 %indvars.iv.next, %n69  br i1 %exitcond.not, label %exit, label %for.body70 71exit:72  %0 = select i1 %.any.0.off0, i32 2, i32 373  %1 = select i1 %all.off, i32 1, i32 %074  ret i32 %175}76