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
diff --git a/lib/builtins/fixunsdfdi.c b/lib/builtins/fixunsdfdi.c
index b93d1c1..2e0d87e 100644
--- a/lib/builtins/fixunsdfdi.c
+++ b/lib/builtins/fixunsdfdi.c
@@ -21,6 +21,7 @@
 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;
diff --git a/lib/builtins/fixunsdfti.c b/lib/builtins/fixunsdfti.c
index c3d7df9..f8046a0 100644
--- a/lib/builtins/fixunsdfti.c
+++ b/lib/builtins/fixunsdfti.c
@@ -17,7 +17,7 @@
 #include "fp_fixuint_impl.inc"
 
 COMPILER_RT_ABI tu_int
-__fixunsdftti(fp_t a) {
+__fixunsdfti(fp_t a) {
     return __fixuint(a);
 }
 #endif /* CRT_HAS_128BIT */
diff --git a/lib/builtins/fixunssfdi.c b/lib/builtins/fixunssfdi.c
index 374ebbe..5a154e8 100644
--- a/lib/builtins/fixunssfdi.c
+++ b/lib/builtins/fixunssfdi.c
@@ -21,6 +21,7 @@
 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;