11; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter-out-after "^scalar.ph:" --version 5
2- ; RUN: opt -passes=loop-vectorize < %s -S -o - | FileCheck %s
2+ ; RUN: opt -mattr=+mve - passes=loop-vectorize < %s -S -o - | FileCheck %s
33
4- source_filename = "<source>"
54target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
65target triple = "thumbv8.1m.main-unknown-none-eabihf"
76
@@ -12,7 +11,7 @@ define void @fn(i32 noundef %n, ptr %in, ptr %out) #0 {
1211; CHECK-SAME: i32 noundef [[N:%.*]], ptr [[IN:%.*]], ptr [[OUT:%.*]]) #[[ATTR0:[0-9]+]] {
1312; CHECK-NEXT: [[ENTRY:.*:]]
1413; CHECK-NEXT: [[CMP46_NOT:%.*]] = icmp eq i32 [[N]], 0
15- ; CHECK-NEXT: br i1 [[CMP46_NOT]], [[FOR_COND_CLEANUP :label %.*]], label %[[FOR_BODY_PREHEADER:.*]]
14+ ; CHECK-NEXT: br i1 [[CMP46_NOT]], [[EXIT :label %.*]], label %[[FOR_BODY_PREHEADER:.*]]
1615; CHECK: [[FOR_BODY_PREHEADER]]:
1716; CHECK-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_MEMCHECK:.*]]
1817; CHECK: [[VECTOR_MEMCHECK]]:
@@ -78,31 +77,22 @@ define void @fn(i32 noundef %n, ptr %in, ptr %out) #0 {
7877; CHECK-NEXT: [[TMP32:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
7978; CHECK-NEXT: br i1 [[TMP32]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]
8079; CHECK: [[MIDDLE_BLOCK]]:
81- ; CHECK-NEXT: br [[FOR_COND_CLEANUP_LOOPEXIT :label %.*]]
80+ ; CHECK-NEXT: br [[EXIT_LOOPEXIT :label %.*]]
8281; CHECK: [[SCALAR_PH]]:
8382;
8483entry:
8584 %cmp46.not = icmp eq i32 %n , 0
86- br i1 %cmp46.not , label %for.cond.cleanup , label %for.body.preheader
87-
88- for.body.preheader: ; preds = %entry
89- br label %for.body
90-
91- for.cond.cleanup.loopexit: ; preds = %for.body
92- br label %for.cond.cleanup
93-
94- for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
95- ret void
85+ br i1 %cmp46.not , label %exit , label %for.body
9686
9787for.body: ; preds = %for.body.preheader, %for.body
98- %in.addr.049 = phi ptr [ %incdec.ptr2 , %for.body ], [ %in , %for.body.preheader ]
99- %out.addr.048 = phi ptr [ %incdec.ptr34 , %for.body ], [ %out , %for.body.preheader ]
100- %i.047 = phi i32 [ %inc , %for.body ], [ 0 , %for.body.preheader ]
101- %incdec.ptr = getelementptr inbounds nuw i8 , ptr %in.addr.049 , i32 1
102- %0 = load i8 , ptr %in.addr.049 , align 1
103- %incdec.ptr1 = getelementptr inbounds nuw i8 , ptr %in.addr.049 , i32 2
88+ %ptr.iv.1 = phi ptr [ %in , %entry ], [ %ptr.iv.1.next , %for.body ]
89+ %ptr.iv.2 = phi ptr [ %out , %entry ], [ %ptr.iv.2.next , %for.body ]
90+ %iv = phi i32 [ %iv.next , %for.body ], [ 0 , %entry ]
91+ %incdec.ptr = getelementptr inbounds nuw i8 , ptr %ptr.iv.1 , i32 1
92+ %0 = load i8 , ptr %ptr.iv.1 , align 1
93+ %incdec.ptr1 = getelementptr inbounds nuw i8 , ptr %ptr.iv.1 , i32 2
10494 %1 = load i8 , ptr %incdec.ptr , align 1
105- %incdec.ptr2 = getelementptr inbounds nuw i8 , ptr %in.addr.049 , i32 3
95+ %ptr.iv.1.next = getelementptr inbounds nuw i8 , ptr %ptr.iv.1 , i32 3
10696 %2 = load i8 , ptr %incdec.ptr1 , align 1
10797 %conv = zext i8 %0 to i32
10898 %mul = mul nuw nsw i32 %conv , 19595
@@ -131,17 +121,16 @@ for.body: ; preds = %for.body.preheader,
131121 %add29 = add nuw i32 %add28 , %mul27
132122 %shr30 = lshr i32 %add29 , 16
133123 %conv31 = trunc i32 %shr30 to i8
134- %incdec.ptr32 = getelementptr inbounds nuw i8 , ptr %out.addr.048 , i32 1
135- store i8 %conv9 , ptr %out.addr.048 , align 1
136- %incdec.ptr33 = getelementptr inbounds nuw i8 , ptr %out.addr.048 , i32 2
124+ %incdec.ptr32 = getelementptr inbounds nuw i8 , ptr %ptr.iv.2 , i32 1
125+ store i8 %conv9 , ptr %ptr.iv.2 , align 1
126+ %incdec.ptr33 = getelementptr inbounds nuw i8 , ptr %ptr.iv.2 , i32 2
137127 store i8 %conv20 , ptr %incdec.ptr32 , align 1
138- %incdec.ptr34 = getelementptr inbounds nuw i8 , ptr %out.addr.048 , i32 3
128+ %ptr.iv.2.next = getelementptr inbounds nuw i8 , ptr %ptr.iv.2 , i32 3
139129 store i8 %conv31 , ptr %incdec.ptr33 , align 1
140- %inc = add nuw i32 %i.047 , 1
141- %exitcond.not = icmp eq i32 %inc , %n
142- br i1 %exitcond.not , label %for.cond.cleanup.loopexit , label %for.body , !llvm.loop !7
143- }
144-
145- attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) "target-features" ="+mve" }
130+ %iv.next = add nuw i32 %iv , 1
131+ %exitcond.not = icmp eq i32 %iv.next , %n
132+ br i1 %exitcond.not , label %exit , label %for.body
146133
147- !7 = !{!"llvm.loop.mustprogress" }
134+ exit: ; preds = %for.cond.cleanup.loopexit, %entry
135+ ret void
136+ }
0 commit comments