about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rwxr-xr-xmath/gen-libm-test.pl11
-rw-r--r--math/libm-test.inc1053
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c168
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c158
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llrintl.S94
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundl.S167
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lrintl.S2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lroundl.S2
9 files changed, 1053 insertions, 632 deletions
diff --git a/ChangeLog b/ChangeLog
index d4d12f172a..21522271ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,35 @@
 2006-03-16  Roland McGrath  <roland@redhat.com>
 
+	* math/gen-libm-test.pl (parse_args): Take function name for pretty
+	output as an argument.
+	(generate_testfile): Pass it the name given in the START macro.
+
+	[BZ #2466]
+	* math/libm-test.inc (llrint_test, llround_test): Fix last change to
+	protect large-precision cases with [LDBL_MANT_DIG > 100].
+	(llrint_test_tonearest, llrint_test_towardzero): Likewise.
+	(llrint_test_downward, llrint_test_upward): Likewise.
+
+2006-03-15  Steven Munroe  <sjmunroe@us.ibm.com>
+	    Alan Modra  <amodra@bigpond.net.au>
+
+	[BZ #2466]
+	* math/libm-test.inc (llrint_test, llround_test) [TEST_LDOUBLE]:
+	Add new test values.
+	(llrint_test_tonearest, llrint_test_towardzero, llrint_test_downward,
+	llrint_test_upward): New functions.
+	(main): Call them.
+
+	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c (__llrintl): Handle
+	rounding that spans doubles in IBM long double format.
+	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c (__llroundl): Likewise.
+	* sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: Removed.
+	* sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: Removed.
+	* sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: Removed.
+	* sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: Removed.
+
+2006-03-16  Roland McGrath  <roland@redhat.com>
+
 	* wcsmbs/wchar.h (__wcstol_internal, __wcstoul_internal): Declare these
 	 only when we will use them, under [__OPTIMIZE__ && __GNUC__ >= 2].
 	(__wcstoll_internal, __wcstoull_internal_defined): Likewise.
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 26f819a884..a63f62a1cb 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -234,7 +234,7 @@ sub special_functions {
 
 # Parse the arguments to TEST_x_y
 sub parse_args {
-  my ($file, $descr, $args) = @_;
+  my ($file, $descr, $fct, $args) = @_;
   my (@args, $str, $descr_args, $descr_res, @descr);
   my ($current_arg, $cline, $i);
   my ($pre, $post, @special);
@@ -248,7 +248,7 @@ sub parse_args {
 
   @args = split /,\s*/, $args;
 
-  $call = "$args[0] (";
+  $call = "$fct (";
 
   # Generate first the string that's shown to the user
   $current_arg = 1;
@@ -423,7 +423,7 @@ sub parse_args {
 sub generate_testfile {
   my ($input, $output) = @_;
   my ($lasttext);
-  my (@args, $i, $str);
+  my (@args, $i, $str, $thisfct);
 
   open INPUT, $input or die ("Can't open $input: $!");
   open OUTPUT, ">$output" or die ("Can't open $output: $!");
@@ -436,11 +436,12 @@ sub generate_testfile {
       my ($descr, $args);
       chop;
       ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
-      &parse_args (\*OUTPUT, $descr, $args);
+      &parse_args (\*OUTPUT, $descr, $thisfct, $args);
       next;
     }
     # START (function)
     if (/START/) {
+      ($thisfct) = ($_ =~ /START\s*\((.*)\)/);
       print OUTPUT "  init_max_error ();\n";
       next;
     }
diff --git a/math/libm-test.inc b/math/libm-test.inc
index b144796f2a..b99255fd6d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -3331,6 +3331,22 @@ llrint_test (void)
   TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
   TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
 
+# if LDBL_MANT_DIG > 100
+  TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+  TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+  TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+  TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+  TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+  TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+  TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+  TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+  TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+  TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+  TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+  TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+#endif
+
   TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
   TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
   TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
@@ -3343,6 +3359,22 @@ llrint_test (void)
   TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
   TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
 
+# if LDBL_MANT_DIG > 100
+  TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+  TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+  TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+  TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+  TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+  TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+  TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+  TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+  TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+  TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+  TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+  TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+#endif
+
   TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
   TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
   TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
@@ -3354,11 +3386,570 @@ llrint_test (void)
   TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
   TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
   TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+  TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+  TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+  TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+  TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+  TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+  TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+  TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+  TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+  TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+  TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+  TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+  TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
 #endif
 
   END (llrint);
 }
 
+static void
+llrint_test_tonearest (void)
+{
+  int save_round_mode;
+  START (llrint_tonearest);
+
+  save_round_mode = fegetround ();
+
+  if (!fesetround (FE_TONEAREST))
+    {
+      TEST_f_L (llrint, 0.0, 0);
+      TEST_f_L (llrint, minus_zero, 0);
+      TEST_f_L (llrint, 0.2L, 0);
+      TEST_f_L (llrint, -0.2L, 0);
+
+      TEST_f_L (llrint, 1.4L, 1);
+      TEST_f_L (llrint, -1.4L, -1);
+
+      TEST_f_L (llrint, 8388600.3L, 8388600);
+      TEST_f_L (llrint, -8388600.3L, -8388600);
+
+      TEST_f_l (llrint, 1071930.0008, 1071930);
+
+      /* Test boundary conditions.  */
+      /* 0x1FFFFF */
+      TEST_f_L (llrint, 2097151.0,2097151LL);
+      /* 0x800000 */
+      TEST_f_L (llrint, 8388608.0, 8388608LL);
+      /* 0x1000000 */
+      TEST_f_L (llrint, 16777216.0, 16777216LL);
+      /* 0x20000000000 */
+      TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+      /* 0x40000000000 */
+      TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+      /* 0x1000000000000 */
+      TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+      /* 0x10000000000000 */
+      TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+      /* 0x10000080000000 */
+      TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+      /* 0x20000000000000 */
+      TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+      /* 0x80000000000000 */
+      TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+      /* 0x100000000000000 */
+      TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+      /* The input can only be represented in long double.  */
+      TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+      TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+      TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+#endif
+
+      TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+      TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+      TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+#endif
+
+      TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+      TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+      TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+      TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+      TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+      TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+    }
+
+  fesetround (save_round_mode);
+
+  END (llrint_tonearest);
+}
+
+static void
+llrint_test_towardzero (void)
+{
+  int save_round_mode;
+  START (llrint_towardzero);
+
+  save_round_mode = fegetround ();
+
+  if (!fesetround (FE_TOWARDZERO))
+    {
+      TEST_f_L (llrint, 0.0, 0);
+      TEST_f_L (llrint, minus_zero, 0);
+      TEST_f_L (llrint, 0.2L, 0);
+      TEST_f_L (llrint, -0.2L, 0);
+
+      TEST_f_L (llrint, 1.4L, 1);
+      TEST_f_L (llrint, -1.4L, -1);
+
+      TEST_f_L (llrint, 8388600.3L, 8388600);
+      TEST_f_L (llrint, -8388600.3L, -8388600);
+
+      TEST_f_l (llrint, 1071930.0008, 1071930);
+
+      /* Test boundary conditions.  */
+      /* 0x1FFFFF */
+      TEST_f_L (llrint, 2097151.0,2097151LL);
+      /* 0x800000 */
+      TEST_f_L (llrint, 8388608.0, 8388608LL);
+      /* 0x1000000 */
+      TEST_f_L (llrint, 16777216.0, 16777216LL);
+      /* 0x20000000000 */
+      TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+      /* 0x40000000000 */
+      TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+      /* 0x1000000000000 */
+      TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+      /* 0x10000000000000 */
+      TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+      /* 0x10000080000000 */
+      TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+      /* 0x20000000000000 */
+      TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+      /* 0x80000000000000 */
+      TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+      /* 0x100000000000000 */
+      TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+      /* The input can only be represented in long double.  */
+      TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
+
+      TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
+      TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
+
+      TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
+      TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
+#endif
+
+      TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
+
+      TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
+
+      TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
+#endif
+
+      TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
+      TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
+
+      TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
+      TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
+      TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
+      TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+      TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+    }
+
+  fesetround (save_round_mode);
+
+  END (llrint_towardzero);
+}
+
+static void
+llrint_test_downward (void)
+{
+  int save_round_mode;
+  START (llrint_downward);
+
+  save_round_mode = fegetround ();
+
+  if (!fesetround (FE_DOWNWARD))
+    {
+      TEST_f_L (llrint, 0.0, 0);
+      TEST_f_L (llrint, minus_zero, 0);
+      TEST_f_L (llrint, 0.2L, 0);
+      TEST_f_L (llrint, -0.2L, -1);
+
+      TEST_f_L (llrint, 1.4L, 1);
+      TEST_f_L (llrint, -1.4L, -2);
+
+      TEST_f_L (llrint, 8388600.3L, 8388600);
+      TEST_f_L (llrint, -8388600.3L, -8388601);
+
+      TEST_f_l (llrint, 1071930.0008, 1071930);
+
+      /* Test boundary conditions.  */
+      /* 0x1FFFFF */
+      TEST_f_L (llrint, 2097151.0,2097151LL);
+      /* 0x800000 */
+      TEST_f_L (llrint, 8388608.0, 8388608LL);
+      /* 0x1000000 */
+      TEST_f_L (llrint, 16777216.0, 16777216LL);
+      /* 0x20000000000 */
+      TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+      /* 0x40000000000 */
+      TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+      /* 0x1000000000000 */
+      TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+      /* 0x10000000000000 */
+      TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+      /* 0x10000080000000 */
+      TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+      /* 0x20000000000000 */
+      TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+      /* 0x80000000000000 */
+      TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+      /* 0x100000000000000 */
+      TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+      /* The input can only be represented in long double.  */
+      TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
+
+      TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
+      TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
+
+      TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+      TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
+      TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+
+      TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
+
+      TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
+      TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
+
+      TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+      TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
+      TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+
+      TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
+      TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
+
+      TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
+      TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
+      TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+      TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
+      TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
+      TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+      TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
+      TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+      TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+    }
+
+  fesetround (save_round_mode);
+
+  END (llrint_downward);
+}
+
+static void
+llrint_test_upward (void)
+{
+  int save_round_mode;
+  START (llrint_upward);
+
+  save_round_mode = fegetround ();
+
+  if (!fesetround (FE_UPWARD))
+    {
+      TEST_f_L (llrint, 0.0, 0);
+      TEST_f_L (llrint, minus_zero, 0);
+      TEST_f_L (llrint, 0.2L, 1);
+      TEST_f_L (llrint, -0.2L, 0);
+
+      TEST_f_L (llrint, 1.4L, 2);
+      TEST_f_L (llrint, -1.4L, -1);
+
+      TEST_f_L (llrint, 8388600.3L, 8388601);
+      TEST_f_L (llrint, -8388600.3L, -8388600);
+#ifndef TEST_FLOAT
+      TEST_f_l (llrint, 1071930.0008, 1071931);
+#endif
+      /* Test boundary conditions.  */
+      /* 0x1FFFFF */
+      TEST_f_L (llrint, 2097151.0,2097151LL);
+      /* 0x800000 */
+      TEST_f_L (llrint, 8388608.0, 8388608LL);
+      /* 0x1000000 */
+      TEST_f_L (llrint, 16777216.0, 16777216LL);
+      /* 0x20000000000 */
+      TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+      /* 0x40000000000 */
+      TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+      /* 0x1000000000000 */
+      TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+      /* 0x10000000000000 */
+      TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+      /* 0x10000080000000 */
+      TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+      /* 0x20000000000000 */
+      TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+      /* 0x80000000000000 */
+      TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+      /* 0x100000000000000 */
+      TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+      /* The input can only be represented in long double.  */
+      TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+      TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
+      TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
+      TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+      TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+      TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+      TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
+
+      TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+      TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+      TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
+      TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
+      TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
+
+      TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+      TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
+      TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+      TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+      TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+      TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
+
+      TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+      TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
+      TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
+      TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
+
+      TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+      TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
+      TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
+      TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+      TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+      TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
+      TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
+      TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
+
+# if LDBL_MANT_DIG > 100
+      TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
+      TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+      TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
+      TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
+      TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+      TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+    }
+
+  fesetround (save_round_mode);
+
+  END (llrint_upward);
+}
+
 
 static void
 log_test (void)
@@ -3597,6 +4188,22 @@ llround_test (void)
   TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
   TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
 
+# if LDBL_MANT_DIG > 100
+  TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
+  TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
+  TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
+  TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
+  TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
+  TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+  TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
+  TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
+  TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
+  TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
+  TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
+  TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
+# endif
+
   TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
   TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
   TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
@@ -3609,6 +4216,22 @@ llround_test (void)
   TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
   TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
 
+# if LDBL_MANT_DIG > 100
+  TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
+  TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
+  TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
+  TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
+  TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
+  TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+  TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
+  TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
+  TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
+  TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
+  TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
+  TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
+# endif
+
   TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
   TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
   TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
@@ -4044,7 +4667,7 @@ rint_test (void)
   TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
   TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
   TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
-  
+
 # if LDBL_MANT_DIG > 100
   TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
   TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
@@ -4056,7 +4679,7 @@ rint_test (void)
   TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
   TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
   TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
-  
+
 # if LDBL_MANT_DIG > 100
   TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
   TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
@@ -4117,66 +4740,66 @@ rint_test_tonearest (void)
   int save_round_mode;
   START (rint_tonearest);
 
-  save_round_mode = fegetround();
+  save_round_mode = fegetround ();
 
   if (!fesetround (FE_TONEAREST))
-  {
-    TEST_f_f (rint, 2.0, 2.0);
-    TEST_f_f (rint, 1.5, 2.0);
-    TEST_f_f (rint, 1.0, 1.0);
-    TEST_f_f (rint, 0.5, 0.0);
-    TEST_f_f (rint, 0.0, 0.0);
-    TEST_f_f (rint, minus_zero, minus_zero);
-    TEST_f_f (rint, -0.5, -0.0);
-    TEST_f_f (rint, -1.0, -1.0);
-    TEST_f_f (rint, -1.5, -2.0);
-    TEST_f_f (rint, -2.0, -2.0);
-    TEST_f_f (rint, 0.1, 0.0);
-    TEST_f_f (rint, 0.25, 0.0);
-    TEST_f_f (rint, 0.625, 1.0);
-    TEST_f_f (rint, -0.1, -0.0);
-    TEST_f_f (rint, -0.25, -0.0);
-    TEST_f_f (rint, -0.625, -1.0);
+    {
+      TEST_f_f (rint, 2.0, 2.0);
+      TEST_f_f (rint, 1.5, 2.0);
+      TEST_f_f (rint, 1.0, 1.0);
+      TEST_f_f (rint, 0.5, 0.0);
+      TEST_f_f (rint, 0.0, 0.0);
+      TEST_f_f (rint, minus_zero, minus_zero);
+      TEST_f_f (rint, -0.5, -0.0);
+      TEST_f_f (rint, -1.0, -1.0);
+      TEST_f_f (rint, -1.5, -2.0);
+      TEST_f_f (rint, -2.0, -2.0);
+      TEST_f_f (rint, 0.1, 0.0);
+      TEST_f_f (rint, 0.25, 0.0);
+      TEST_f_f (rint, 0.625, 1.0);
+      TEST_f_f (rint, -0.1, -0.0);
+      TEST_f_f (rint, -0.25, -0.0);
+      TEST_f_f (rint, -0.625, -1.0);
 #ifdef TEST_LDOUBLE
-  /* The result can only be represented in long double.  */
-    TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
-    TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+      /* The result can only be represented in long double.  */
+      TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
 # endif
-    TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
-    TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+      TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
-
-    TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
-    TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
-
-    TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
-    TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
+      TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
+
+      TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+      TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+      TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+      TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
 # endif
 #endif
-  }
+    }
 
-  fesetround(save_round_mode);
+  fesetround (save_round_mode);
 
   END (rint_tonearest);
 }
@@ -4187,66 +4810,66 @@ rint_test_towardzero (void)
   int save_round_mode;
   START (rint_towardzero);
 
-  save_round_mode = fegetround();
+  save_round_mode = fegetround ();
 
   if (!fesetround (FE_TOWARDZERO))
-  {
-    TEST_f_f (rint, 2.0, 2.0);
-    TEST_f_f (rint, 1.5, 1.0);
-    TEST_f_f (rint, 1.0, 1.0);
-    TEST_f_f (rint, 0.5, 0.0);
-    TEST_f_f (rint, 0.0, 0.0);
-    TEST_f_f (rint, minus_zero, minus_zero);
-    TEST_f_f (rint, -0.5, -0.0);
-    TEST_f_f (rint, -1.0, -1.0);
-    TEST_f_f (rint, -1.5, -1.0);
-    TEST_f_f (rint, -2.0, -2.0);
-    TEST_f_f (rint, 0.1, 0.0);
-    TEST_f_f (rint, 0.25, 0.0);
-    TEST_f_f (rint, 0.625, 0.0);
-    TEST_f_f (rint, -0.1, -0.0);
-    TEST_f_f (rint, -0.25, -0.0);
-    TEST_f_f (rint, -0.625, -0.0);
+    {
+      TEST_f_f (rint, 2.0, 2.0);
+      TEST_f_f (rint, 1.5, 1.0);
+      TEST_f_f (rint, 1.0, 1.0);
+      TEST_f_f (rint, 0.5, 0.0);
+      TEST_f_f (rint, 0.0, 0.0);
+      TEST_f_f (rint, minus_zero, minus_zero);
+      TEST_f_f (rint, -0.5, -0.0);
+      TEST_f_f (rint, -1.0, -1.0);
+      TEST_f_f (rint, -1.5, -1.0);
+      TEST_f_f (rint, -2.0, -2.0);
+      TEST_f_f (rint, 0.1, 0.0);
+      TEST_f_f (rint, 0.25, 0.0);
+      TEST_f_f (rint, 0.625, 0.0);
+      TEST_f_f (rint, -0.1, -0.0);
+      TEST_f_f (rint, -0.25, -0.0);
+      TEST_f_f (rint, -0.625, -0.0);
 #ifdef TEST_LDOUBLE
-  /* The result can only be represented in long double.  */
-    TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
+      /* The result can only be represented in long double.  */
+      TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
-    TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
+      TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
 # endif
-    TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
-    TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
-
-    TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
-    TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
-    TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
-
-    TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
-    TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
-    TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
+      TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
+
+      TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+      TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
+      TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
+
+      TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+      TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
+      TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
 # endif
 #endif
-  }
+    }
 
-  fesetround(save_round_mode);
+  fesetround (save_round_mode);
 
   END (rint_towardzero);
 }
@@ -4257,66 +4880,66 @@ rint_test_downward (void)
   int save_round_mode;
   START (rint_downward);
 
-  save_round_mode = fegetround();
+  save_round_mode = fegetround ();
 
   if (!fesetround (FE_DOWNWARD))
-  {
-    TEST_f_f (rint, 2.0, 2.0);
-    TEST_f_f (rint, 1.5, 1.0);
-    TEST_f_f (rint, 1.0, 1.0);
-    TEST_f_f (rint, 0.5, 0.0);
-    TEST_f_f (rint, 0.0, 0.0);
-    TEST_f_f (rint, minus_zero, minus_zero);
-    TEST_f_f (rint, -0.5, -1.0);
-    TEST_f_f (rint, -1.0, -1.0);
-    TEST_f_f (rint, -1.5, -2.0);
-    TEST_f_f (rint, -2.0, -2.0);
-    TEST_f_f (rint, 0.1, 0.0);
-    TEST_f_f (rint, 0.25, 0.0);
-    TEST_f_f (rint, 0.625, 0.0);
-    TEST_f_f (rint, -0.1, -1.0);
-    TEST_f_f (rint, -0.25, -1.0);
-    TEST_f_f (rint, -0.625, -1.0);
+    {
+      TEST_f_f (rint, 2.0, 2.0);
+      TEST_f_f (rint, 1.5, 1.0);
+      TEST_f_f (rint, 1.0, 1.0);
+      TEST_f_f (rint, 0.5, 0.0);
+      TEST_f_f (rint, 0.0, 0.0);
+      TEST_f_f (rint, minus_zero, minus_zero);
+      TEST_f_f (rint, -0.5, -1.0);
+      TEST_f_f (rint, -1.0, -1.0);
+      TEST_f_f (rint, -1.5, -2.0);
+      TEST_f_f (rint, -2.0, -2.0);
+      TEST_f_f (rint, 0.1, 0.0);
+      TEST_f_f (rint, 0.25, 0.0);
+      TEST_f_f (rint, 0.625, 0.0);
+      TEST_f_f (rint, -0.1, -1.0);
+      TEST_f_f (rint, -0.25, -1.0);
+      TEST_f_f (rint, -0.625, -1.0);
 #ifdef TEST_LDOUBLE
-  /* The result can only be represented in long double.  */
-    TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
+      /* The result can only be represented in long double.  */
+      TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
-    TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
+      TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
 # endif
-    TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
-    TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
-    TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
-    TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+      TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
-
-    TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
-    TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
-    TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
-
-    TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
-    TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
+      TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
+
+      TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+      TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
+      TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
+
+      TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
+      TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
 # endif
 #endif
-  }
+    }
 
-  fesetround(save_round_mode);
+  fesetround (save_round_mode);
 
   END (rint_downward);
 }
@@ -4327,66 +4950,66 @@ rint_test_upward (void)
   int save_round_mode;
   START (rint_upward);
 
-  save_round_mode = fegetround();
+  save_round_mode = fegetround ();
 
   if (!fesetround (FE_UPWARD))
-  {
-    TEST_f_f (rint, 2.0, 2.0);
-    TEST_f_f (rint, 1.5, 2.0);
-    TEST_f_f (rint, 1.0, 1.0);
-    TEST_f_f (rint, 0.5, 1.0);
-    TEST_f_f (rint, 0.0, 0.0);
-    TEST_f_f (rint, minus_zero, minus_zero);
-    TEST_f_f (rint, -0.5, -0.0);
-    TEST_f_f (rint, -1.0, -1.0);
-    TEST_f_f (rint, -1.5, -1.0);
-    TEST_f_f (rint, -2.0, -2.0);
-    TEST_f_f (rint, 0.1, 1.0);
-    TEST_f_f (rint, 0.25, 1.0);
-    TEST_f_f (rint, 0.625, 1.0);
-    TEST_f_f (rint, -0.1, -0.0);
-    TEST_f_f (rint, -0.25, -0.0);
-    TEST_f_f (rint, -0.625, -0.0);
+    {
+      TEST_f_f (rint, 2.0, 2.0);
+      TEST_f_f (rint, 1.5, 2.0);
+      TEST_f_f (rint, 1.0, 1.0);
+      TEST_f_f (rint, 0.5, 1.0);
+      TEST_f_f (rint, 0.0, 0.0);
+      TEST_f_f (rint, minus_zero, minus_zero);
+      TEST_f_f (rint, -0.5, -0.0);
+      TEST_f_f (rint, -1.0, -1.0);
+      TEST_f_f (rint, -1.5, -1.0);
+      TEST_f_f (rint, -2.0, -2.0);
+      TEST_f_f (rint, 0.1, 1.0);
+      TEST_f_f (rint, 0.25, 1.0);
+      TEST_f_f (rint, 0.625, 1.0);
+      TEST_f_f (rint, -0.1, -0.0);
+      TEST_f_f (rint, -0.25, -0.0);
+      TEST_f_f (rint, -0.625, -0.0);
 #ifdef TEST_LDOUBLE
-  /* The result can only be represented in long double.  */
-    TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
-    TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
-    TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
-    TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+      /* The result can only be represented in long double.  */
+      TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
-    TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
-    TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
+      TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
+      TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
+      TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
 # endif
-    TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
-    TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
+      TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
+      TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
 # if LDBL_MANT_DIG > 100
-    TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
-    TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
-    TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
-
-    TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
-    TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
-    TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
-    TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
-
-    TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
-    TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
-    TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
-    TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
-    TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
+      TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
+      TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
+
+      TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
+      TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
+      TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
+      TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+      TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+      TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+      TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
+      TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
+      TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
 # endif
 #endif
-  }
+    }
 
-  fesetround(save_round_mode);
+  fesetround (save_round_mode);
 
   END (rint_upward);
 }
@@ -4419,7 +5042,7 @@ round_test (void)
   /* The result can only be represented in long double.  */
   TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
   TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
-  TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L); 
+  TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
   TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
   TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
@@ -4428,10 +5051,10 @@ round_test (void)
   TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
 # endif
 
-  TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L); 
-  TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L); 
+  TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+  TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
   TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
-  TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L); 
+  TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
   TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
 # if LDBL_MANT_DIG > 100
   TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
@@ -4870,13 +5493,13 @@ trunc_test (void)
   TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
   TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
 # endif
-  
+
   TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
   TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
   TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
   TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
   TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
-  
+
 # if LDBL_MANT_DIG > 100
   TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
   TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
@@ -4929,7 +5552,7 @@ trunc_test (void)
   TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
   TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
   TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
-  TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L); 
+  TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
 #endif
 
   END (trunc);
@@ -5315,6 +5938,10 @@ main (int argc, char **argv)
   rint_test_upward ();
   lrint_test ();
   llrint_test ();
+  llrint_test_tonearest ();
+  llrint_test_towardzero ();
+  llrint_test_downward ();
+  llrint_test_upward ();
   round_test ();
   lround_test ();
   llround_test ();
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
index bacf1bee0d..7228489098 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -22,6 +22,7 @@
    when it's coded in C.  */
 
 #include <math.h>
+#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
@@ -36,89 +37,114 @@ __llrintl (x)
      long double x;
 #endif
 {
-  static const double TWO52 = 4503599627370496.0L;
-  union ibm_extended_long_double u;
-  long long result = __LONG_LONG_MAX__;
+  double xh, xl;
+  long long res, hi, lo;
+  int save_round;
 
-  u.d = x;
+  ldbl_unpack (x, &xh, &xl);
 
-  if (fabs (u.dd[0]) < TWO52)
+  /* Limit the range of values handled by the conversion to long long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (__builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
     {
-      double high = u.dd[0];
-      if (high > 0.0)
-	{
-	  high += TWO52;
-	  high -= TWO52;
-          if (high == -0.0) high = 0.0;
-	}
-      else if (high < 0.0)
+      save_round = fegetround ();
+
+      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
 	{
-	  high -= TWO52;
-	  high += TWO52;
-          if (high == 0.0) high = -0.0;
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_LONG_MAX__;
+	  xh = 1.0;
 	}
-      result = high;
-    }
-  else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
-    {
-      double high, low, tau;
-      long long lowint;
-      /* In this case we have to round the low double and handle any
-         adjustment to the high double that may be caused by rounding
-         (up).  This is complicated by the fact that the high double
-         may already be rounded and the low double may have the
-         opposite sign to compensate.  */
-      if (u.dd[0] > 0.0)
+      else
 	{
-	  if (u.dd[1] > 0.0)
-	    {
-	      /* If the high/low doubles are the same sign then simply
-	         round the low double.  */
-	      high = u.dd[0];
-	      low = u.dd[1];
-	    }
-	  else if (u.dd[1] < 0.0)
-	    {
-	      /* Else the high double is pre rounded and we need to
-	         adjust for that.  */
-	      
-	      tau = nextafter (u.dd[0], 0.0);
-	      tau =  (u.dd[0] - tau) * 2.0;
-	      high = u.dd[0] - tau;
-	      low = u.dd[1] + tau;
-	    }
-	  low += TWO52;
-	  low -= TWO52;
+	  hi = (long long) xh;
+	  xh -= hi;
 	}
-      else if (u.dd[0] < 0.0)
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      switch (save_round)
 	{
-	  if (u.dd[1] < 0.0)
-	    {
-	      /* If the high/low doubles are the same sign then simply
-	         round the low double.  */
-	      high = u.dd[0];
-	      low = u.dd[1];
-	    }
-	  else if (u.dd[1] > 0.0)
-	    {
-	      /* Else the high double is pre rounded and we need to
-	         adjust for that.  */
-	      tau = nextafter (u.dd[0], 0.0);
-	      tau = (u.dd[0] - tau) * 2.0;
-	      high = u.dd[0] - tau;
-	      low = u.dd[1] + tau;
-	    }
-	  low = TWO52 - low;
-	  low = -(low - TWO52);
+	case FE_TONEAREST:
+	  if (fabs (xh) < 0.5
+	      || (fabs (xh) == 0.5
+		  && ((xh > 0.0 && xl < 0.0)
+		      || (xh < 0.0 && xl > 0.0)
+		      || (xl == 0.0 && (res & 1) == 0))))
+	    return res;
+
+	  if (xh < 0.0)
+	    res -= 1;
+	  else
+	    res += 1;
+	  break;
+
+	case FE_TOWARDZERO:
+	  if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0)))
+	    res -= 1;
+	  else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0)))
+	    res += 1;
+	  return res;
+	  break;
+
+	case FE_UPWARD:
+	  if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	    res += 1;
+	  break;
+
+	case FE_DOWNWARD:
+	  if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	    res -= 1;
+	  break;
 	}
-      lowint = low;
-      result = high;
-      result += lowint;
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
     }
   else
-   result = u.dd[0];     
+    {
+      if (xh > 0.0)
+	hi = __LONG_LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
 
-  return result;
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
 }
 
 long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
index 567e7ecc07..103529d5a1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -22,12 +22,11 @@
    when it's coded in C.  */
 
 #include <math.h>
-#include <fenv.h>
+#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
 
-
 #ifdef __STDC__
 long long
 __llroundl (long double x)
@@ -37,92 +36,95 @@ __llroundl (x)
      long double x;
 #endif
 {
-  static const double TWO52 = 4503599627370496.0;
-  static const double HALF = 0.5;
-  int mode = fegetround();
-  union ibm_extended_long_double u;
-  long long result = __LONG_LONG_MAX__;
-
-  u.d = x;
-
-  if (fabs (u.dd[0]) < TWO52)
-    {      
-      fesetround(FE_TOWARDZERO);
-      if (u.dd[0] > 0.0)
+  double xh, xl;
+  long long res, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Limit the range of values handled by the conversion to long long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (__builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
+    {
+      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
 	{
-	  u.dd[0] += HALF;
-	  u.dd[0] += TWO52;
-	  u.dd[0] -= TWO52;
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_LONG_MAX__;
+	  xh = 1.0;
 	}
-      else if (u.dd[0] < 0.0)
+      else
 	{
-	  u.dd[0] = TWO52 - (u.dd[0] - HALF);
-	  u.dd[0] = -(u.dd[0] - TWO52);
+	  hi = (long long) xh;
+	  xh -= hi;
 	}
-      fesetround(mode);
-      result = u.dd[0];
-    }
-  else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
-    {
-      double high, low;
-      long long lowint;
-      /* In this case we have to round the low double and handle any
-         adjustment to the high double that may be caused by rounding
-         (up).  This is complicated by the fact that the high double
-         may already be rounded and the low double may have the
-         opposite sign to compensate.  */
-      if (u.dd[0] > 0.0)
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      if (xh > 0.5)
+	{
+	  res += 1;
+	}
+      else if (xh == 0.5)
 	{
-	  if (u.dd[1] > 0.0)
-	    {
-	      /* If the high/low doubles are the same sign then simply
-	         round the low double.  */
-	      high = u.dd[0];
-	      low = u.dd[1];
-	    }
-	  else if (u.dd[1] < 0.0)
-	    {
-	      /* Else the high double is pre rounded and we need to
-	         adjust for that.  */
-	      high = nextafter (u.dd[0], 0.0);
-	      low = u.dd[1] + (u.dd[0] - high);
-	    }     
-          fesetround(FE_TOWARDZERO);
-	  low += HALF;
-	  low += TWO52;
-	  low -= TWO52;
+	  if (xl > 0.0 || (xl == 0.0 && res >= 0))
+	    res += 1;
 	}
-      else if (u.dd[0] < 0.0)
+      else if (-xh > 0.5)
 	{
-	  if (u.dd[1] < 0.0)
-	    {
-	      /* If the high/low doubles are the same sign then simply
-	         round the low double.  */
-	      high = u.dd[0];
-	      low = u.dd[1];
-	    }
-	  else if (u.dd[1] > 0.0)
-	    {
-	      /* Else the high double is pre rounded and we need to
-	         adjust for that.  */
-	      high = nextafter (u.dd[0], 0.0);
-	      low = u.dd[1] + (u.dd[0] - high);
-	    }     
-          fesetround(FE_TOWARDZERO);
-	  low -= HALF;
-	  low = TWO52 - low;
-	  low = -(low - TWO52);
+	  res -= 1;
 	}
-      fesetround(mode);
-      lowint = low;
-      result = high;
-      result += lowint;
+      else if (-xh == 0.5)
+	{
+	  if (xl < 0.0 || (xl == 0.0 && res <= 0))
+	    res -= 1;
+	}
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
     }
   else
-   {
-      result = u.dd[0];     
-   }
-  return result;
+    {
+      if (xh > 0.0)
+	hi = __LONG_LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
+
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
 }
 
 long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S
deleted file mode 100644
index aa487775d4..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Round long double to long int.
-   IBM extended format long double version.
-   Copyright (C) 2004,2006 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-	.section	".toc","aw"
-.LC0:	/* 2**52 */
-	.tc FD_43300000_0[TC],0x4330000000000000
-.LC1:	/* 2**63 */
-	.tc FD_43E00000_0[TC],0x43e0000000000000
-	.section	".text"
-
-/* long long int[r3] __llrintl (long double x[fp1,fp2])  */
-ENTRY (__llrintl)
-	lfd	fp13,.LC0@toc(2)
-	lfd	fp10,.LC1@toc(2)
-	fabs	fp0,fp1
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
-	fcmpu	cr6,fp0,fp10	/* if (fabs(x) > TWO63)  */
-	beq-	cr6,.L2
-	fctid	fp11,fp1	/* must delay this opperation to here  */
-	fctid	fp12,fp2	/* and avoid setting "invalid operation".  */
-	li	r0,0
-	stfd	fp11,-16(r1)
-	bgt-	cr6,.L9		/* if > TWO63 return  "invalid operation".  */
-	ble+	cr7,.L9		/* If < TWO52 only thy high double is used.  */
-	stfd	fp12,-8(r1)
-	nop	/* Insure the following load is in a different dispatch group */
-	nop	/* to avoid pipe stall on POWER4&5.  */
-	nop
-.L8:
-	ld	r0,-8(r1)
-.L9:
-	ld	r3,-16(r1)
-	add	r3,r3,r0
-	blr
-
-/* The high double is >= TWO63 so it looks like we are "out of range".
-   But this may be caused by rounding of the high double and the
-   negative low double may bring it back into range. So we need to
-   de-round the high double and invert the low double without changing
-   the effective long double value. To do this we compute a special
-   value (tau) that we can subtract from the high double and add to
-   the low double before conversion. The resulting integers can be
-   summed to get the total value.
-
-   tau = floor(x_high/TWO52);
-   x0 = x_high - tau;
-   x1 = x_low + tau;  */
-.L2:
-	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
-	fctidz	fp0,fp8
-	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
-	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
-	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
-	fctid	fp11,fp3
-	fctid	fp12,fp4
-	stfd	fp11,-16(r1)
-	stfd	fp12,-8(r1)
-	nop	/* Insure the following load is in a different dispatch group */
-	nop	/* to avoid pipe stall on POWER4&5.  */
-	nop
-	ld	r3,-16(r1)
-	ld	r0,-8(r1)
-	addo.	r3,r3,r0
-	bnslr+  cr0		/* if the sum does not overflow, return.  */
-	fctid	fp11,fp1	/* Otherwise we want to set "invalid operation".  */
-	li	r0,0
-	stfd	fp11,-16(r1)
-	b	.L9
-
-END (__llrintl)
-
-strong_alias (__llrintl, __lrintl)
-long_double_symbol (libm, __llrintl, llrintl)
-long_double_symbol (libm, __lrintl, lrintl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S
deleted file mode 100644
index 29eca11093..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/* llroundl function.
-   IBM extended format long double version.
-   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-	.section	".toc","aw"
-.LC0:	/* 0.0 */
-	.tc FD_00000000_0[TC],0x0000000000000000
-.LC1:	/* 0.5 */
-	.tc FD_3fe00000_0[TC],0x3fe0000000000000
-.LC2:	/* 2**52 */
-	.tc FD_43300000_0[TC],0x4330000000000000
-.LC3:	/* 2**63 */
-	.tc FD_43E00000_0[TC],0x43e0000000000000
-	.section	".text"
-
-/* long long [r3] llround (long double x [fp1,fp2])
-   IEEE 1003.1 llroundl function.  IEEE specifies "round to the nearest
-   integer value, rounding halfway cases away from zero, regardless of
-   the current rounding mode."  However PowerPC Architecture defines
-   "round to Nearest" as "Choose the best approximation. In case of a
-   tie, choose the one that is even (least significant bit o).".
-   So we can't use the PowerPC "round to Nearest" mode. Instead we set
-   "round toward Zero" mode and round by adding +-0.5 before rounding
-   toward zero. The "Floating Convert To Integer Doubleword with round
-   toward zero" instruction handles the conversion including the
-   overflow cases and signalling "Invalid Operation".
-
-   PowerPC64 long double uses the IBM extended format which is
-   represented two 64-floating point double values. The values are
-   non-overlapping giving an effective precision of 106 bits. The first
-   double contains the high order bits of mantisa and is always rounded
-   to represent a normal rounding of long double to double. Since the
-   long double value is sum of the high and low values, the low double
-   normally has the opposite sign to compensate for the this rounding.
-
-   For long double there is 4 cases:
-   1) |x| < 2**52, all the integer bits are in the high double.
-      Round and convert the high double to long long.
-   2) 2**52 <= |x|< 2**63, Still fits but need bits from both doubles.
-      Round the low double, convert both, then sum the long long values.
-   3) |x| == 2**63, Looks like an overflow but may not be due to rounding
-      of the high double.
-      See the description following lable L2.
-   4) |x| > 2**63, This will overflow the 64-bit signed integer.
-      Treat like case #1. The fctidz instruction will generate the
-      appropriate and signal "invalid operation".
-
-   */
-
-ENTRY (__llroundl)
-	mffs	fp7		/* Save current FPU rounding mode.  */
-	fabs	fp0,fp1
-	lfd	fp13,.LC2@toc(2)	/* 2**52 */
-	lfd	fp12,.LC3@toc(2)	/* 2**63 */
-	lfd	fp11,.LC0@toc(2)	/* 0.0 */
-	lfd	fp10,.LC1@toc(2)	/* 0.5 */
-	fabs	fp9,fp2
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
-	fcmpu	cr6,fp1,fp11	/* if (x > 0.0)  */
-	bnl-	cr7,.L2
-	mtfsfi	7,1		/* Set rounding mode toward 0.  */
-	ble-	cr6,.L1
-	fadd	fp9,fp1,fp10	/* x+= 0.5;  */
-	b	.L0
-.L1:
-	fsub	fp9,fp1,fp10	/* x-= 0.5;  */
-.L0:
-	fctid	fp0,fp9
-	stfd	fp0,-16(r1)
-	mtfsf	0x01,fp7	/* restore previous rounding mode.  */
-	nop	/* Insure the following load is in a different dispatch group */
-	nop	/* to avoid pipe stall on POWER4&5.  */
-	nop
-	ld	r3,-16(r1)
-	blr
-
-/* The high double is > TWO52 so we need to round the low double and
-   perhaps the high double.  In this case we have to round the low
-   double and handle any adjustment to the high double that may be
-   caused by rounding (up).  This is complicated by the fact that the
-   high double may already be rounded and the low double may have the
-   opposite sign to compensate.This gets a bit tricky so we use the
-   following algorithm:
-
-   tau = trunc(x_high/TWO52);
-   x0 = x_high - tau;
-   x1 = x_low + tau;
-   r1 = round(x1);
-   y_high = x0 + r1;
-   y_low = x0 - y_high + r1;
-   return y;  */
-.L2:
-	fcmpu	cr7,fp0,fp12	/* if (|x_high| > TWO63)  */
-	fcmpu	cr0,fp9,fp11	/* || (|x_low| == 0.0)  */
-	fmr	fp9,fp1
-	fcmpu	cr5,fp2,fp11	/* if (x_low > 0.0)  */
-	bgt-	cr7,.L0		/*   return llround(x);	*/
-	mtfsfi	7,1		/* Set rounding mode toward 0.  */
-	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
-	
-	bng-	cr6,.L6		/* if (x > 0.0)  */
-	fctidz	fp0,fp8
-	fcfid	fp8,fp0		/* tau = trunc(x_high/TWO52);  */
-	bng	cr5,.L4		/* if (x_low > 0.0)  */
-	fmr	fp3,fp1
-	fmr	fp4,fp2
-	b	.L5
-.L4:				/* if (x_low < 0.0)  */
-	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
-	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
-.L5:
-	fadd	fp5,fp4,fp10	/* r1 = x1 + 0.5;  */
-	b	.L9
-.L6:				/* if (x < 0.0)  */
-	fctidz	fp0,fp8
-	fcfid	fp8,fp0		/* tau = trunc(x_high/TWO52);  */	
-	bnl	cr5,.L7		/* if (x_low < 0.0)  */
-	fmr	fp3,fp1
-	fmr	fp4,fp2
-	b	.L8
-.L7:				/* if (x_low > 0.0)  */
-	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
-	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
-.L8:
-	fsub	fp5,fp4,fp10	/* r1 = x1 - 0.5;  */
-.L9:
-	fctid.	fp11,fp3
-	fctid	fp12,fp5
-	stfd	fp11,-16(r1)
-	stfd	fp12,-8(r1)
-	mtfsf	0x01,fp7	/* restore previous rounding mode.  */
-	nop	/* Insure the following load is in a different dispatch group */
-	nop	/* to avoid pipe stall on POWER4&5.  */
-	nop
-	ld	r3,-16(r1)
-	bunlr   cr1		/* if not overflow, return.  */
-	ld	r0,-8(r1)
-	addo.	r3,r3,r0
-	bnslr	cr0
-	fmr	fp9,fp12
-	bng	cr6,.L0
-	fneg	fp9,fp12
-	b	.L0
-END (__llroundl)
-
-strong_alias (__llroundl, __lroundl)
-long_double_symbol (libm, __llroundl, llroundl)
-long_double_symbol (libm, __lroundl, lroundl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S b/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S
deleted file mode 100644
index 6c82d2e222..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S
+++ /dev/null
@@ -1,2 +0,0 @@
-/* __lrintl is in s_llrintl.c  */
-/* __lrintl is in s_llrintl.c  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S b/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S
deleted file mode 100644
index b24dfd8ded..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S
+++ /dev/null
@@ -1,2 +0,0 @@
-/* __lroundl is in s_llroundl.S  */
-/* __lroundl is in s_llroundl.S  */