1; REQUIRES: asserts 2; RUN: opt < %s -loop-vectorize -debug-only=loop-vectorize -S 2>&1 | FileCheck %s 3 4target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 5target triple = "arm64-apple-ios5.0.0" 6 7define void @selects_1(i32* nocapture %dst, i32 %A, i32 %B, i32 %C, i32 %N) { 8; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and 9; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and 10; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6 11 12; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and 13; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and 14; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6 15 16; CHECK-LABEL: define void @selects_1( 17; CHECK: vector.body: 18; CHECK: select <2 x i1> 19 20entry: 21 %cmp26 = icmp sgt i32 %N, 0 22 br i1 %cmp26, label %for.body.preheader, label %for.cond.cleanup 23 24for.body.preheader: ; preds = %entry 25 %wide.trip.count = zext i32 %N to i64 26 br label %for.body 27 28for.body: ; preds = %for.body.preheader, %for.body 29 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 30 %arrayidx = getelementptr inbounds i32, i32* %dst, i64 %indvars.iv 31 %0 = load i32, i32* %arrayidx, align 4 32 %and = and i32 %0, 2047 33 %cmp1 = icmp eq i32 %and, %A 34 %cond = select i1 %cmp1, i32 10, i32 %and 35 %cmp2 = icmp eq i32 %and, %B 36 %cond6 = select i1 %cmp2, i32 30, i32 %and 37 %cmp7 = icmp ugt i32 %cond, %C 38 %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6 39 store i32 %cond11, i32* %arrayidx, align 4 40 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 41 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count 42 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body 43 44for.cond.cleanup.loopexit: ; preds = %for.body 45 br label %for.cond.cleanup 46 47for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 48 ret void 49} 50