2 ; RUN: opt < %s -passes=loop-vectorize -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5 target triple = "arm64-apple-ios5.0.0"
7 define void @selects_1(ptr nocapture %dst, i32 %A, i32 %B, i32 %C, i32 %N) {
8 ; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
9 ; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
10 ; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
12 ; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
13 ; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
14 ; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
16 ; CHECK-LABEL: define void @selects_1(
18 ; CHECK: select <4 x i1>
21 %cmp26 = icmp sgt i32 %N, 0
22 br i1 %cmp26, label %for.body.preheader, label %for.cond.cleanup
24 for.body.preheader: ; preds = %entry
25 %wide.trip.count = zext i32 %N to i64
28 for.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, ptr %dst, i64 %indvars.iv
31 %0 = load i32, ptr %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, ptr %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
44 for.cond.cleanup.loopexit: ; preds = %for.body
45 br label %for.cond.cleanup
47 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry