4
4
5
5
; Test cases for selecting the index with the minimum value.
6
6
7
- define i64 @test_vectorize_select_umin_idx (ptr %src ) {
7
+ define i64 @test_vectorize_select_umin_idx (ptr %src , i64 %n ) {
8
8
; CHECK-LABEL: @test_vectorize_select_umin_idx(
9
9
; CHECK-NOT: vector.body:
10
10
;
@@ -21,15 +21,15 @@ loop:
21
21
%min.val.next = tail call i64 @llvm.umin.i64 (i64 %min.val , i64 %l )
22
22
%min.idx.next = select i1 %cmp , i64 %iv , i64 %min.idx
23
23
%iv.next = add nuw nsw i64 %iv , 1
24
- %exitcond.not = icmp eq i64 %iv.next , 0
24
+ %exitcond.not = icmp eq i64 %iv.next , %n
25
25
br i1 %exitcond.not , label %exit , label %loop
26
26
27
27
exit:
28
28
%res = phi i64 [ %min.idx.next , %loop ]
29
29
ret i64 %res
30
30
}
31
31
32
- define i64 @test_vectorize_select_umin_idx_all_exit_inst (ptr %src , ptr %umin ) {
32
+ define i64 @test_vectorize_select_umin_idx_all_exit_inst (ptr %src , ptr %umin , i64 %n ) {
33
33
; CHECK-LABEL: @test_vectorize_select_umin_idx_all_exit_inst(
34
34
; CHECK-NOT: vector.body:
35
35
;
46
46
%min.val.next = tail call i64 @llvm.umin.i64 (i64 %min.val , i64 %l )
47
47
%min.idx.next = select i1 %cmp , i64 %iv , i64 %min.idx
48
48
%iv.next = add nuw nsw i64 %iv , 1
49
- %exitcond.not = icmp eq i64 %iv.next , 0
49
+ %exitcond.not = icmp eq i64 %iv.next , %n
50
50
br i1 %exitcond.not , label %exit , label %loop
51
51
52
52
exit:
56
56
ret i64 %res
57
57
}
58
58
59
- define i64 @test_vectorize_select_umin_idx_min_ops_switched (ptr %src ) {
59
+ define i64 @test_vectorize_select_umin_idx_min_ops_switched (ptr %src , i64 %n ) {
60
60
; CHECK-LABEL: @test_vectorize_select_umin_idx_min_ops_switched(
61
61
; CHECK-NOT: vector.body:
62
62
;
@@ -73,15 +73,15 @@ loop:
73
73
%min.val.next = tail call i64 @llvm.umin.i64 (i64 %l , i64 %min.val )
74
74
%min.idx.next = select i1 %cmp , i64 %iv , i64 %min.idx
75
75
%iv.next = add nuw nsw i64 %iv , 1
76
- %exitcond.not = icmp eq i64 %iv.next , 0
76
+ %exitcond.not = icmp eq i64 %iv.next , %n
77
77
br i1 %exitcond.not , label %exit , label %loop
78
78
79
79
exit:
80
80
%res = phi i64 [ %min.idx.next , %loop ]
81
81
ret i64 %res
82
82
}
83
83
84
- define i64 @test_not_vectorize_select_no_min_reduction (ptr %src ) {
84
+ define i64 @test_not_vectorize_select_no_min_reduction (ptr %src , i64 %n ) {
85
85
; CHECK-LABEL: @test_not_vectorize_select_no_min_reduction(
86
86
; CHECK-NOT: vector.body:
87
87
;
99
99
%foo = call i64 @llvm.umin.i64 (i64 %min.val , i64 %l )
100
100
%min.idx.next = select i1 %cmp , i64 %iv , i64 %min.idx
101
101
%iv.next = add nuw nsw i64 %iv , 1
102
- %exitcond.not = icmp eq i64 %iv.next , 0
102
+ %exitcond.not = icmp eq i64 %iv.next , %n
103
103
br i1 %exitcond.not , label %exit , label %loop
104
104
105
105
exit:
@@ -108,7 +108,7 @@ exit:
108
108
}
109
109
110
110
111
- define i64 @test_not_vectorize_cmp_value (i64 %x ) {
111
+ define i64 @test_not_vectorize_cmp_value (i64 %x , i64 %n ) {
112
112
; CHECK-LABEL: @test_not_vectorize_cmp_value(
113
113
; CHECK-NOT: vector.body:
114
114
;
@@ -123,15 +123,15 @@ loop:
123
123
%min.val.next = tail call i64 @llvm.umin.i64 (i64 %min.val , i64 0 )
124
124
%min.idx.next = select i1 %cmp , i64 %iv , i64 %min.idx
125
125
%iv.next = add nuw nsw i64 %iv , 1
126
- %exitcond.not = icmp eq i64 %iv.next , 0
126
+ %exitcond.not = icmp eq i64 %iv.next , %n
127
127
br i1 %exitcond.not , label %exit , label %loop
128
128
129
129
exit:
130
130
%res = phi i64 [ %min.idx.next , %loop ]
131
131
ret i64 %res
132
132
}
133
133
134
- define i32 @test_vectorize_select_umin_idx_with_trunc () {
134
+ define i32 @test_vectorize_select_umin_idx_with_trunc (i64 %n ) {
135
135
; CHECK-LABEL: @test_vectorize_select_umin_idx_with_trunc(
136
136
; CHECK-NOT: vector.body:
137
137
;
@@ -147,7 +147,7 @@ loop:
147
147
%trunc = trunc i64 %iv to i32
148
148
%min.idx.next = select i1 %cmp , i32 %trunc , i32 %min.idx
149
149
%iv.next = add nuw nsw i64 %iv , 1
150
- %exitcond.not = icmp eq i64 %iv.next , 0
150
+ %exitcond.not = icmp eq i64 %iv.next , %n
151
151
br i1 %exitcond.not , label %exit , label %loop
152
152
153
153
exit:
0 commit comments