summaryrefslogtreecommitdiff
path: root/test/Transforms/LoopVectorize/intrinsic.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-02-27 15:24:19 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-02-27 15:24:19 +0000
commit2fe71f8f7e678174ba217d3d16525092805ad45b (patch)
tree2a7c8c39d45019a50ffd9dfc90209366a77f8f4d /test/Transforms/LoopVectorize/intrinsic.ll
parentf404449e23a8584bff19eb5db49e1dc1161afdef (diff)
downloadllvm-2fe71f8f7e678174ba217d3d16525092805ad45b.tar.gz
llvm-2fe71f8f7e678174ba217d3d16525092805ad45b.tar.bz2
llvm-2fe71f8f7e678174ba217d3d16525092805ad45b.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopVectorize/intrinsic.ll')
-rw-r--r--test/Transforms/LoopVectorize/intrinsic.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/LoopVectorize/intrinsic.ll b/test/Transforms/LoopVectorize/intrinsic.ll
index 7d5a5d706b..e79d78de67 100644
--- a/test/Transforms/LoopVectorize/intrinsic.ll
+++ b/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}