diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-27 15:24:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-27 15:24:19 +0000 |
commit | dc145816fdf2ef92af473e6ec83abd33d28b6466 (patch) | |
tree | cbd1c1b6e3cd3f6ba699634022dd703a262a155f /llvm/test/Transforms | |
parent | 0da400cf92e30fc5d231a8ad248a829e5167c3c2 (diff) | |
download | bcm5719-llvm-dc145816fdf2ef92af473e6ec83abd33d28b6466.tar.gz bcm5719-llvm-dc145816fdf2ef92af473e6ec83abd33d28b6466.zip |
LoopVectorize: Vectorize math builtin calls.
This properly asks TargetLibraryInfo if a call is available and if it is, it
can be translated into the corresponding LLVM builtin. We don't vectorize sqrt()
yet because I'm not sure about the semantics for negative numbers. The other
intrinsic should be exact equivalents to the libm functions.
Differential Revision: http://llvm-reviews.chandlerc.com/D465
llvm-svn: 176188
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/intrinsic.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/intrinsic.ll b/llvm/test/Transforms/LoopVectorize/intrinsic.ll index 7d5a5d706bb..e79d78de67c 100644 --- a/llvm/test/Transforms/LoopVectorize/intrinsic.ll +++ b/llvm/test/Transforms/LoopVectorize/intrinsic.ll @@ -902,6 +902,30 @@ for.end: ; preds = %for.body, %entry ret void } +; CHECK: fabs_libm +; CHECK: call <4 x float> @llvm.fabs.v4f32 +; CHECK: ret void +define void @fabs_libm(float* nocapture %x) nounwind { +entry: + br label %for.body + +for.body: ; preds = %entry, %for.body + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] + %arrayidx = getelementptr inbounds float* %x, i64 %indvars.iv + %0 = load float* %arrayidx, align 4 + %call = tail call float @fabsf(float %0) nounwind readnone + store float %call, float* %arrayidx, align 4 + %indvars.iv.next = add i64 %indvars.iv, 1 + %lftr.wideiv = trunc i64 %indvars.iv.next to i32 + %exitcond = icmp eq i32 %lftr.wideiv, 1024 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body + ret void +} + +declare float @fabsf(float) nounwind readnone + declare double @llvm.pow.f64(double, double) nounwind readnone !0 = metadata !{metadata !"float", metadata !1} |