summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2014-01-29 18:55:44 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2014-01-29 18:55:44 +0000
commit85a26704e9075c3c1a80d2a4504e6aa03707a7bf (patch)
treeb20ab25545dca68ac290112de3a3e29c1836f231
parentc25b0c7e12c49ab4c0e728b2d4db00cfa3a66102 (diff)
downloadbcm5719-llvm-85a26704e9075c3c1a80d2a4504e6aa03707a7bf.tar.gz
bcm5719-llvm-85a26704e9075c3c1a80d2a4504e6aa03707a7bf.zip
LoopVectorizer: Add a test case for unrolling of small loops that need a runtime
check. llvm-svn: 200408
-rw-r--r--llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll b/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
index ea107dc4dc5..1f0944d24d0 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
@@ -48,3 +48,26 @@ define i32 @bar(i32* nocapture %A, i32 %n) nounwind uwtable ssp {
._crit_edge: ; preds = %.lr.ph, %0
ret i32 undef
}
+
+; Also unroll if we need a runtime check.
+; CHECK-LABEL: runtime_chk
+; CHECK: store <4 x float>
+; CHECK: store <4 x float>
+define void @runtime_chk(float* %A, float* %B, float %N) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds float* %B, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %mul = fmul float %0, %N
+ %arrayidx2 = getelementptr inbounds float* %A, i64 %indvars.iv
+ store float %mul, float* %arrayidx2, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 256
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret void
+}
OpenPOWER on IntegriCloud