about summary refs log tree commit diff
path: root/sysdeps/alpha/fpu/s_floor.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/alpha/fpu/s_floor.c')
-rw-r--r--sysdeps/alpha/fpu/s_floor.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c
index b22c52303d..29fc924c71 100644
--- a/sysdeps/alpha/fpu/s_floor.c
+++ b/sysdeps/alpha/fpu/s_floor.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -28,25 +28,21 @@
 double
 __floor (double x)
 {
-  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
-    {
-      double tmp1, new_x;
-
-      __asm (
+  double two52 = copysign (0x1.0p52, x);
+  double r, tmp;
+  
+  __asm (
 #ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
 #else
-	     "cvttq/svm %2,%1\n\t"
+	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1)
-	     : "f"(x));
-
-      /* floor(-0) == -0, and in general we'll always have the same
-	 sign as our input.  */
-      x = copysign(new_x, x);
-    }
-  return x;
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(x), "f"(two52));
+
+  /* floor(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysign (r, x);
 }
 
 weak_alias (__floor, floor)