1
1
; REQUIRES: asserts
2
- ; RUN: opt < %s -passes=loop-vectorize -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
2
+ ; RUN: opt < %s -passes=loop-vectorize -debug-only=loop-vectorize -disable-output - S 2>&1 | FileCheck %s
3
3
4
4
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5
5
target triple = "arm64-apple-ios5.0.0"
6
6
7
7
define void @selects_1 (ptr nocapture %dst , i32 %A , i32 %B , i32 %C , i32 %N ) {
8
+ ; CHECK: LV: Checking a loop in 'selects_1'
8
9
; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
9
10
; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
10
11
; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
11
12
12
13
; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
13
14
; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
14
15
; CHECK: LV: Found an estimated cost of 1 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 <4 x i1>
16
+ ; CHECK: LV: Selecting VF: 4
19
17
20
18
entry:
21
19
%cmp26 = icmp sgt i32 %N , 0
22
20
br i1 %cmp26 , label %for.body.preheader , label %for.cond.cleanup
23
21
24
22
for.body.preheader: ; preds = %entry
25
- %wide.trip.count = zext i32 %N to i64
23
+ %n = zext i32 %N to i64
26
24
br label %for.body
27
25
28
26
for.body: ; preds = %for.body.preheader, %for.body
@@ -38,7 +36,7 @@ for.body: ; preds = %for.body.preheader,
38
36
%cond11 = select i1 %cmp7 , i32 %cond , i32 %cond6
39
37
store i32 %cond11 , ptr %arrayidx , align 4
40
38
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
41
- %exitcond.not = icmp eq i64 %indvars.iv.next , %wide.trip.count
39
+ %exitcond.not = icmp eq i64 %indvars.iv.next , %n
42
40
br i1 %exitcond.not , label %for.cond.cleanup.loopexit , label %for.body
43
41
44
42
for.cond.cleanup.loopexit: ; preds = %for.body
@@ -47,3 +45,31 @@ for.cond.cleanup.loopexit: ; preds = %for.body
47
45
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
48
46
ret void
49
47
}
48
+
49
+ define i32 @multi_user_cmp (ptr readonly %a , i64 noundef %n ) {
50
+ ; CHECK: LV: Checking a loop in 'multi_user_cmp'
51
+ ; CHECK: LV: Found an estimated cost of 4 for VF 16 For instruction: %cmp1 = fcmp olt float %load1, 0.000000e+00
52
+ ; CHECK: LV: Found an estimated cost of 1 for VF 16 For instruction: %.any.0.off0 = select i1 %cmp1, i1 true, i1 %any.0.off09
53
+ ; CHECK: LV: Found an estimated cost of 1 for VF 16 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
54
+ ; CHECK: LV: Selecting VF: 16.
55
+ entry:
56
+ br label %for.body
57
+
58
+ for.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.iv
63
+ %load1 = load float , ptr %arrayidx , align 4
64
+ %cmp1 = fcmp olt float %load1 , 0 .000000e+00
65
+ %.any.0.off0 = select i1 %cmp1 , i1 true , i1 %any.0.off09
66
+ %all.off = select i1 %cmp1 , i1 %all.off.next , i1 false
67
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
68
+ %exitcond.not = icmp eq i64 %indvars.iv.next , %n
69
+ br i1 %exitcond.not , label %exit , label %for.body
70
+
71
+ exit:
72
+ %0 = select i1 %.any.0.off0 , i32 2 , i32 3
73
+ %1 = select i1 %all.off , i32 1 , i32 %0
74
+ ret i32 %1
75
+ }
0 commit comments