1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes=loop-vectorize \ 3; RUN: -force-tail-folding-style=data-with-evl \ 4; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ 5; RUN: -mtriple=powerpc64le-unknown-linux-gnu \ 6; RUN: -mcpu=pwr10 -S < %s | FileCheck %s 7 8; RUN: opt -passes=loop-vectorize \ 9; RUN: -force-tail-folding-style=none \ 10; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ 11; RUN: -mtriple=powerpc64le-unknown-linux-gnu \ 12; RUN: -mcpu=pwr10 -S < %s | FileCheck %s 13 14define void @foo(ptr noalias %a, ptr noalias %b, ptr noalias %c, i64 %N) { 15; CHECK-LABEL: @foo( 16; CHECK-NEXT: entry: 17; CHECK-NEXT: br label [[FOR_BODY:%.*]] 18; CHECK: for.body: 19; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 20; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[IV]] 21; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 22; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[C:%.*]], i64 [[IV]] 23; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX2]], align 4 24; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]] 25; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IV]] 26; CHECK-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX4]], align 4 27; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 28; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[IV_NEXT]], [[N:%.*]] 29; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]] 30; CHECK: for.cond.cleanup: 31; CHECK-NEXT: ret void 32; 33entry: 34 br label %for.body 35 36for.body: 37 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 38 %arrayidx = getelementptr inbounds i32, ptr %b, i64 %iv 39 %0 = load i32, ptr %arrayidx, align 4 40 %arrayidx2 = getelementptr inbounds i32, ptr %c, i64 %iv 41 %1 = load i32, ptr %arrayidx2, align 4 42 %add = add nsw i32 %1, %0 43 %arrayidx4 = getelementptr inbounds i32, ptr %a, i64 %iv 44 store i32 %add, ptr %arrayidx4, align 4 45 %iv.next = add nuw nsw i64 %iv, 1 46 %exitcond.not = icmp eq i64 %iv.next, %N 47 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body 48 49for.cond.cleanup: 50 ret void 51} 52