@@ -29,14 +29,14 @@ entry:
29
29
for.body:
30
30
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
31
31
%arrayidx = getelementptr inbounds float , ptr %in , i64 %indvars.iv
32
- %0 = load float , ptr %arrayidx , align 4
33
- %call = tail call { float , float } @foo (float %0 ) #0
34
- %1 = extractvalue { float , float } %call , 0
35
- %2 = extractvalue { float , float } %call , 1
32
+ %in_val = load float , ptr %arrayidx , align 4
33
+ %call = tail call { float , float } @foo (float %in_val ) #0
34
+ %extract_a = extractvalue { float , float } %call , 0
35
+ %extract_b = extractvalue { float , float } %call , 1
36
36
%arrayidx2 = getelementptr inbounds float , ptr %out_a , i64 %indvars.iv
37
- store float %1 , ptr %arrayidx2 , align 4
37
+ store float %extract_a , ptr %arrayidx2 , align 4
38
38
%arrayidx4 = getelementptr inbounds float , ptr %out_b , i64 %indvars.iv
39
- store float %2 , ptr %arrayidx4 , align 4
39
+ store float %extract_b , ptr %arrayidx4 , align 4
40
40
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
41
41
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
42
42
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
@@ -69,14 +69,14 @@ entry:
69
69
for.body:
70
70
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
71
71
%arrayidx = getelementptr inbounds double , ptr %in , i64 %indvars.iv
72
- %0 = load double , ptr %arrayidx , align 8
73
- %call = tail call { double , double } @bar (double %0 ) #1
74
- %1 = extractvalue { double , double } %call , 0
75
- %2 = extractvalue { double , double } %call , 1
72
+ %in_val = load double , ptr %arrayidx , align 8
73
+ %call = tail call { double , double } @bar (double %in_val ) #1
74
+ %extract_a = extractvalue { double , double } %call , 0
75
+ %extract_b = extractvalue { double , double } %call , 1
76
76
%arrayidx2 = getelementptr inbounds double , ptr %out_a , i64 %indvars.iv
77
- store double %1 , ptr %arrayidx2 , align 8
77
+ store double %extract_a , ptr %arrayidx2 , align 8
78
78
%arrayidx4 = getelementptr inbounds double , ptr %out_b , i64 %indvars.iv
79
- store double %2 , ptr %arrayidx4 , align 8
79
+ store double %extract_b , ptr %arrayidx4 , align 8
80
80
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
81
81
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
82
82
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
@@ -107,15 +107,15 @@ entry:
107
107
for.body:
108
108
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
109
109
%arrayidx = getelementptr inbounds float , ptr %in , i64 %indvars.iv
110
- %0 = load float , ptr %arrayidx , align 4
110
+ %in_val = load float , ptr %arrayidx , align 4
111
111
; #3 does not have a fixed-size vector mapping (so replication is used)
112
- %call = tail call { float , float } @foo (float %0 ) #3
113
- %1 = extractvalue { float , float } %call , 0
114
- %2 = extractvalue { float , float } %call , 1
112
+ %call = tail call { float , float } @foo (float %in_val ) #3
113
+ %extract_a = extractvalue { float , float } %call , 0
114
+ %extract_b = extractvalue { float , float } %call , 1
115
115
%arrayidx2 = getelementptr inbounds float , ptr %out_a , i64 %indvars.iv
116
- store float %1 , ptr %arrayidx2 , align 4
116
+ store float %extract_a , ptr %arrayidx2 , align 4
117
117
%arrayidx4 = getelementptr inbounds float , ptr %out_b , i64 %indvars.iv
118
- store float %2 , ptr %arrayidx4 , align 4
118
+ store float %extract_b , ptr %arrayidx4 , align 4
119
119
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
120
120
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
121
121
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
@@ -150,14 +150,14 @@ entry:
150
150
for.body:
151
151
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
152
152
%arrayidx = getelementptr inbounds float , ptr %in , i64 %indvars.iv
153
- %0 = load float , ptr %arrayidx , align 4
154
- %call = tail call { float , float } @foo (float %0 ) #0
155
- %1 = extractvalue { float , float } %call , 0
156
- %2 = extractvalue { float , float } %call , 1
153
+ %in_val = load float , ptr %arrayidx , align 4
154
+ %call = tail call { float , float } @foo (float %in_val ) #0
155
+ %extract_a = extractvalue { float , float } %call , 0
156
+ %extract_b = extractvalue { float , float } %call , 1
157
157
%arrayidx2 = getelementptr inbounds float , ptr %out_a , i64 %indvars.iv
158
- store float %1 , ptr %arrayidx2 , align 4
158
+ store float %extract_a , ptr %arrayidx2 , align 4
159
159
%arrayidx4 = getelementptr inbounds float , ptr %out_b , i64 %indvars.iv
160
- store float %2 , ptr %arrayidx4 , align 4
160
+ store float %extract_b , ptr %arrayidx4 , align 4
161
161
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
162
162
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
163
163
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
@@ -181,14 +181,14 @@ entry:
181
181
for.body:
182
182
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
183
183
%arrayidx = getelementptr inbounds float , ptr %in , i64 %indvars.iv
184
- %0 = load float , ptr %arrayidx , align 4
185
- %call = tail call { float , i32 } @baz (float %0 ) #2
186
- %1 = extractvalue { float , i32 } %call , 0
187
- %2 = extractvalue { float , i32 } %call , 1
184
+ %in_val = load float , ptr %arrayidx , align 4
185
+ %call = tail call { float , i32 } @baz (float %in_val ) #2
186
+ %extract_a = extractvalue { float , i32 } %call , 0
187
+ %extract_b = extractvalue { float , i32 } %call , 1
188
188
%arrayidx2 = getelementptr inbounds float , ptr %out_a , i64 %indvars.iv
189
- store float %1 , ptr %arrayidx2 , align 4
189
+ store float %extract_a , ptr %arrayidx2 , align 4
190
190
%arrayidx4 = getelementptr inbounds i32 , ptr %out_b , i64 %indvars.iv
191
- store i32 %2 , ptr %arrayidx4 , align 4
191
+ store i32 %extract_b , ptr %arrayidx4 , align 4
192
192
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
193
193
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
194
194
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
@@ -214,14 +214,47 @@ entry:
214
214
for.body:
215
215
%indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
216
216
%arrayidx = getelementptr inbounds double , ptr %in , i64 %indvars.iv
217
- %0 = load double , ptr %arrayidx , align 8
218
- %call = tail call %named_struct @bar_named (double %0 ) #4
219
- %1 = extractvalue %named_struct %call , 0
220
- %2 = extractvalue %named_struct %call , 1
217
+ %in_val = load double , ptr %arrayidx , align 8
218
+ %call = tail call %named_struct @bar_named (double %in_val ) #4
219
+ %extract_a = extractvalue %named_struct %call , 0
220
+ %extract_b = extractvalue %named_struct %call , 1
221
221
%arrayidx2 = getelementptr inbounds double , ptr %out_a , i64 %indvars.iv
222
- store double %1 , ptr %arrayidx2 , align 8
222
+ store double %extract_a , ptr %arrayidx2 , align 8
223
223
%arrayidx4 = getelementptr inbounds double , ptr %out_b , i64 %indvars.iv
224
- store double %2 , ptr %arrayidx4 , align 8
224
+ store double %extract_b , ptr %arrayidx4 , align 8
225
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
226
+ %exitcond.not = icmp eq i64 %indvars.iv.next , 1024
227
+ br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
228
+
229
+ for.cond.cleanup:
230
+ ret void
231
+ }
232
+
233
+ ; TODO: Allow mixed-struct type vectorization and mark overflow intrinsics as trivially vectorizable.
234
+ define void @test_overflow_intrinsic (ptr noalias readonly %in , ptr noalias writeonly %out_a , ptr noalias writeonly %out_b ) {
235
+ ; NEON-LABEL: define void @test_overflow_intrinsic
236
+ ; NEON-NOT: vector.body:
237
+ ; SVE_TF-NOT: @llvm.sadd.with.overflow.v{{.+}}i32
238
+ ;
239
+ ; SVE_TF-LABEL: define void @test_overflow_intrinsic
240
+ ; SVE_TF-NOT: vector.body:
241
+ ; SVE_TF-NOT: @llvm.sadd.with.overflow.v{{.+}}i32
242
+ ; SVE_TF-NOT: @llvm.sadd.with.overflow.nxv{{.+}}i32
243
+ entry:
244
+ br label %for.body
245
+
246
+ for.body:
247
+ %indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
248
+ %arrayidx = getelementptr inbounds float , ptr %in , i64 %indvars.iv
249
+ %in_val = load i32 , ptr %arrayidx , align 4
250
+ %call = tail call { i32 , i1 } @llvm.sadd.with.overflow.i32 (i32 %in_val , i32 %in_val )
251
+ %extract_ret = extractvalue { i32 , i1 } %call , 0
252
+ %extract_overflow = extractvalue { i32 , i1 } %call , 1
253
+ %zext_overflow = zext i1 %extract_overflow to i8
254
+ %arrayidx2 = getelementptr inbounds i32 , ptr %out_a , i64 %indvars.iv
255
+ store i32 %extract_ret , ptr %arrayidx2 , align 4
256
+ %arrayidx4 = getelementptr inbounds i8 , ptr %out_b , i64 %indvars.iv
257
+ store i8 %zext_overflow , ptr %arrayidx4 , align 4
225
258
%indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
226
259
%exitcond.not = icmp eq i64 %indvars.iv.next , 1024
227
260
br i1 %exitcond.not , label %for.cond.cleanup , label %for.body
0 commit comments