summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-08-18 19:27:32 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-08-18 19:27:32 +0000
commit2b749571066384109c7602153d5dc25516a71d72 (patch)
tree5ecbf8463988d7a680e50d62808a8084499fe2fe /test
parentb9d6b8449d245ee1607f6f197b29befbf8c41a1e (diff)
downloadllvm-2b749571066384109c7602153d5dc25516a71d72.tar.gz
llvm-2b749571066384109c7602153d5dc25516a71d72.tar.bz2
llvm-2b749571066384109c7602153d5dc25516a71d72.tar.xz
SimplifyLibcalls: Add fabs and trunc to the list of libcalls that are safe to shrink from double to float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/SimplifyLibCalls/floor.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyLibCalls/floor.ll b/test/Transforms/SimplifyLibCalls/floor.ll
index 03dcdf585f..93c62c2002 100644
--- a/test/Transforms/SimplifyLibCalls/floor.ll
+++ b/test/Transforms/SimplifyLibCalls/floor.ll
@@ -9,6 +9,8 @@
; DO-SIMPLIFY: call float @ceilf(
; DO-SIMPLIFY: call float @roundf(
; DO-SIMPLIFY: call float @nearbyintf(
+; DO-SIMPLIFY: call float @truncf(
+; DO-SIMPLIFY: call float @fabsf(
; C89-SIMPLIFY: call float @floorf(
; C89-SIMPLIFY: call float @ceilf(
@@ -19,6 +21,8 @@
; DONT-SIMPLIFY: call double @ceil(
; DONT-SIMPLIFY: call double @round(
; DONT-SIMPLIFY: call double @nearbyint(
+; DONT-SIMPLIFY: call double @trunc(
+; DONT-SIMPLIFY: call double @fabs(
declare double @floor(double)
@@ -28,6 +32,10 @@ declare double @round(double)
declare double @nearbyint(double)
+declare double @trunc(double)
+
+declare double @fabs(double)
+
define float @test_floor(float %C) {
%D = fpext float %C to double ; <double> [#uses=1]
; --> floorf
@@ -60,3 +68,18 @@ define float @test_nearbyint(float %C) {
ret float %F
}
+define float @test_trunc(float %C) {
+ %D = fpext float %C to double
+ ; --> truncf
+ %E = call double @trunc(double %D)
+ %F = fptrunc double %E to float
+ ret float %F
+}
+
+define float @test_fabs(float %C) {
+ %D = fpext float %C to double
+ ; --> fabsf
+ %E = call double @fabs(double %D)
+ %F = fptrunc double %E to float
+ ret float %F
+}