diff options
author | Derek Schuff <dschuff@google.com> | 2015-05-01 16:02:16 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2015-05-01 16:02:16 +0000 |
commit | 1ab45fe3917f805d3bcf3fd23a351b5a1f76f883 (patch) | |
tree | 5a82f56fae5d216b78d8946275470af04c575f29 /lib/builtins/fixunsdfdi.c | |
parent | 253270bf69eeae5f274bdabfbe08d26c9e3197bb (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/fixunsdfdi.c')
-rw-r--r-- | lib/builtins/fixunsdfdi.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/builtins/fixunsdfdi.c b/lib/builtins/fixunsdfdi.c index b93d1c10b..2e0d87eac 100644 --- a/lib/builtins/fixunsdfdi.c +++ b/lib/builtins/fixunsdfdi.c @@ -21,6 +21,7 @@ ARM_EABI_FNALIAS(d2ulz, fixunsdfdi) COMPILER_RT_ABI du_int __fixunsdfdi(double a) { + if (a <= 0.0) return 0; su_int high = a/0x1p32f; su_int low = a - (double)high*0x1p32f; return ((du_int)high << 32) | low; |