summaryrefslogtreecommitdiff
path: root/lib/builtins/fixunssfdi.c
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2015-05-01 16:02:16 +0000
committerDerek Schuff <dschuff@google.com>2015-05-01 16:02:16 +0000
commit1ab45fe3917f805d3bcf3fd23a351b5a1f76f883 (patch)
tree5a82f56fae5d216b78d8946275470af04c575f29 /lib/builtins/fixunssfdi.c
parent253270bf69eeae5f274bdabfbe08d26c9e3197bb (diff)
Fix float->uint conversion for inputs less than 0
Summary: The spec for these functions says that they should return 0 in this case but this regressed in r234148. That revision essentially delegates the conversion to the hardware, but that has different behavior on different platforms (e.g. it is wrong on x86). Also fix a typo in the name of __fixunsdfti Test Plan: The existing unit tests now pass Reviewers: joerg, howard.hinnant Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9305 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/fixunssfdi.c')
-rw-r--r--lib/builtins/fixunssfdi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/builtins/fixunssfdi.c b/lib/builtins/fixunssfdi.c
index 374ebbe82..5a154e82c 100644
--- a/lib/builtins/fixunssfdi.c
+++ b/lib/builtins/fixunssfdi.c
@@ -21,6 +21,7 @@ ARM_EABI_FNALIAS(f2ulz, fixunssfdi)
COMPILER_RT_ABI du_int
__fixunssfdi(float a)
{
+ if (a <= 0.0f) return 0;
double da = a;
su_int high = da/0x1p32f;
su_int low = da - (double)high*0x1p32f;