This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PPC64 smaller/faster rounding functions


The attached patch implements ceil, floor, llrint, llround, rint, round, and trunc for double and float in PPC64 asm. The result is much smaller and as fast and many cases much faster than the generic implementations.


2004-04-29  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.c: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lround.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lroundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: New file.


diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_ceil.S libc23/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_ceil.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_ceil.S	Thu Apr 22 09:06:16 2004
@@ -0,0 +1,60 @@
+/* ceil function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+.LC1:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+
+ENTRY(__ceil)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
+	ble-	cr6,.L4
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC1@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__ceil)
+
+weak_alias(__ceil,ceil)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__ceil,ceill)
+strong_alias(__ceil,__ceill)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S	Fri Apr 23 14:07:41 2004
@@ -0,0 +1,56 @@
+/* float ceil function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**23 */
+	.tc FD_41600000_0[TC],0x4160000000000000
+.LC1:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+
+ENTRY(__ceilf)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsubs	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
+	ble-	cr6,.L4
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC1@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__ceilf)
+
+weak_alias(__ceilf,ceilf)
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_floor.S libc23/sysdeps/powerpc/powerpc64/fpu/s_floor.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_floor.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_floor.S	Thu Apr 22 08:14:50 2004
@@ -0,0 +1,58 @@
+/* Floor function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+	.section	".text"
+
+ENTRY(__floor)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,3		/* Set rounding mode toward -inf.  */
+	ble-	cr6,.L4
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
+	blr
+	END (__floor)
+
+weak_alias(__floor,floor)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__floor,floorl)
+strong_alias(__floor,__floorl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_floorf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_floorf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_floorf.S	Fri Apr 23 13:57:48 2004
@@ -0,0 +1,54 @@
+/* float Floor function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**23 */
+	.tc FD_41600000_0[TC],0x4160000000000000
+	.section	".text"
+
+ENTRY(__floorf)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsubs	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,3		/* Set rounding mode toward -inf.  */
+	ble-	cr6,.L4
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
+	blr
+	END (__floorf)
+
+weak_alias(__floorf,floorf)
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrint.S libc23/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrint.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llrint.S	Thu Apr 22 13:28:51 2004
@@ -0,0 +1,42 @@
+/* Round double to long int.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+/* long long int[r3] __llrint (double x[fp1])  */
+ENTRY(__llrint)	
+	fctid	fp13,fp1
+	stfd	fp13,-16(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)	
+	blr
+	END (__llrint)
+
+strong_alias (__llrint, __lrint)
+weak_alias (__llrint, llrint)
+weak_alias (__lrint, lrint)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llrint, __llrintl)
+weak_alias (__llrint, llrintl)
+strong_alias (__lrint, __lrintl)
+weak_alias (__lrint, lrintl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrint.c libc23/sysdeps/powerpc/powerpc64/fpu/s_llrint.c
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrint.c	Fri Feb 13 12:16:19 2004
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llrint.c	Wed Dec 31 17:00:00 1969
@@ -1,46 +0,0 @@
-/* Round a double value to a long long in the current rounding mode.
-   Copyright (C) 1997, 2004 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.  */
-
-/* Kludge to avoid decls that will confuse strong_alias below.  */
-#define __lrint XXX__lrint
-#define __lrintl XXX__lrintl
-#define lrint XXXlrint
-#define lrintl XXXlrintl
-
-#include "math.h"
-
-#undef __lrint
-#undef __lrintl
-#undef lrint
-#undef lrintl
-
-long long int
-__llrint (double x)
-{
-  return (long long int) __rint (x);
-}
-strong_alias (__llrint, __lrint)
-weak_alias (__llrint, llrint)
-weak_alias (__lrint, lrint)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llrint, __llrintl)
-weak_alias (__llrint, llrintl)
-strong_alias (__lrint, __lrintl)
-weak_alias (__lrint, lrintl)
-#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S	Thu Apr 22 15:00:35 2004
@@ -0,0 +1,36 @@
+/* Round double to long int.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+/* long long int[r3] __llrintf (float x[fp1])  */
+ENTRY(__llrintf)	
+	fctid	fp13,fp1
+	stfd	fp13,-16(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)	
+	blr
+	END (__llrintf)
+
+strong_alias (__llrintf, __lrintf)
+weak_alias (__llrintf, llrintf)
+weak_alias (__lrintf, lrintf)
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c libc23/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c	Fri Feb 13 12:16:02 2004
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c	Wed Dec 31 17:00:00 1969
@@ -1,36 +0,0 @@
-/* Round a float value to a long long in the current rounding mode.
-   Copyright (C) 1997, 2004 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.  */
-
-/* Kludge to avoid decls that will confuse strong_alias below.  */
-#define __lrintf XXX__lrintf
-#define lrintf XXXlrintf
-
-#include "math.h"
-
-#undef __lrintf
-#undef lrintf
-
-long long int
-__llrintf (float x)
-{
-  return (long long int) __rintf (x);
-}
-strong_alias (__llrintf, __lrintf)
-weak_alias (__llrintf, llrintf)
-weak_alias (__lrintf, lrintf)
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llround.S libc23/sysdeps/powerpc/powerpc64/fpu/s_llround.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llround.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llround.S	Thu Apr 22 15:11:16 2004
@@ -0,0 +1,67 @@
+/* llround function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* -0.0 */
+	.tc FD_00000000_0[TC],0x0000000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+	.section	".text"
+	
+/* long long [r3] llround (float x [fp1])
+   IEEE 1003.1 llround 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
+   to the integer value.  */
+
+ENTRY(__llround)
+	lfd	fp12,.LC0@toc(2)
+	lfd	fp10,.LC1@toc(2)
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	ble-	cr6,.L4
+	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
+.L9:
+	fctidz	fp2,fp1		/* Convert To Integer DW llround toward 0.  */
+	stfd	fp2,-16(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)
+	blr
+.L4:
+	fsub	fp1,fp1,fp10	/* x-= 0.5;  */
+	b	.L9
+	END (__llround)
+
+strong_alias (__llround, __lround)
+weak_alias (__llround, llround)
+weak_alias (__lround, lround)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__llround,llroundl)
+strong_alias(__llround,__llroundl)
+weak_alias(__lround,lroundl)
+strong_alias(__lround,__lroundl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S	Fri Apr 23 12:54:40 2004
@@ -0,0 +1,59 @@
+/* llroundf function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* -0.0 */
+	.tc FD_00000000_0[TC],0x0000000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+	.section	".text"
+	
+/* long long [r3] llroundf (float x [fp1])
+   IEEE 1003.1 llroundf function.  IEEE specifies "roundf to the nearest 
+   integer value, roundfing halfway cases away from zero, regardless of
+   the current roundfing mode."  However PowerPC Architecture defines
+   "roundf 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
+   to the integer value.  */
+
+ENTRY(__llroundf)
+	lfd	fp12,.LC0@toc(2)
+	lfd	fp10,.LC1@toc(2)
+	fcmpu	cr6,fp1,fp12	/* if (x < 0.0)  */
+	fsubs	fp3,fp1,fp10	/* x-= 0.5;  */
+	ble-	cr6,.L9
+	fadds	fp3,fp1,fp10	/* x+= 0.5;  */
+.L9:
+	fctidz	fp2,fp3		/* Convert To Integer DW round toward 0.  */
+	stfd	fp2,-16(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)
+	blr
+	END (__llroundf)
+
+strong_alias (__llroundf, __lroundf)
+weak_alias (__llroundf, llroundf)
+weak_alias (__lroundf, lroundf)
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_lround.S libc23/sysdeps/powerpc/powerpc64/fpu/s_lround.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_lround.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_lround.S	Thu Apr 22 13:32:49 2004
@@ -0,0 +1,2 @@
+/* __lround is in s_llround.S  */
+/* __lround is in s_llround.S  */
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S	Thu Apr 22 15:23:07 2004
@@ -0,0 +1,2 @@
+/* __lroundf is in s_llroundf.S  */
+/* __lroundf is in s_llroundf.S  */
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_rint.S libc23/sysdeps/powerpc/powerpc64/fpu/s_rint.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_rint.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_rint.S	Wed Apr 21 14:56:38 2004
@@ -0,0 +1,54 @@
+/* Round to int floating-point values.  PowerPC64 version.
+   Copyright (C) 2004 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.  */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+   when it's coded in C.  */
+
+#include <sysdep.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+	.section	".text"
+
+ENTRY(__rint)
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	bng-	cr6,.L4
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	blr
+.L4:
+	bnllr-	cr6		/* if (x < 0.0)  */
+	fsub	fp1,fp13,fp1	/* x = TWO52 - x;  */
+	fsub	fp0,fp1,fp13	/* x = - (x - TWO52);  */
+	fneg	fp1,fp0
+	blr
+	END (__rint)
+
+weak_alias(__rint,rint)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__rint,rintl)
+strong_alias(__rint,__rintl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_rintf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_rintf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_rintf.S	Fri Apr 23 13:53:03 2004
@@ -0,0 +1,47 @@
+/* Round float to int floating-point values.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**23 */
+	.tc FD_41600000_0[TC],0x4160000000000000
+	.section	".text"
+
+ENTRY(__rintf)
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsubs	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	bng-	cr6,.L4
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	blr
+.L4:
+	bnllr-	cr6		/* if (x < 0.0)  */
+	fsubs	fp1,fp13,fp1	/* x = TWO23 - x;  */
+	fsubs	fp0,fp1,fp13	/* x = - (x - TWO23);  */
+	fneg	fp1,fp0
+	blr
+	END (__rintf)
+
+weak_alias(__rintf,rintf)
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_round.S libc23/sysdeps/powerpc/powerpc64/fpu/s_round.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_round.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_round.S	Thu Apr 22 11:29:35 2004
@@ -0,0 +1,75 @@
+/* round function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+.LC2:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+	
+/* double [fp1] round (double x [fp1])
+   IEEE 1003.1 round 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
+   to the integer value.  */
+
+ENTRY(__round)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	lfd	fp10,.LC1@toc(2)
+	ble-	cr6,.L4
+	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L4:
+	fsub	fp9,fp1,fp10	/* x+= 0.5;  */
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsub	fp1,fp9,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__round)
+
+weak_alias(__round,round)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__round,roundl)
+strong_alias(__round,__roundl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_roundf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_roundf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_roundf.S	Fri Apr 23 13:38:55 2004
@@ -0,0 +1,71 @@
+/* roundf  function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**23 */
+	.tc FD_41600000_0[TC],0x4160000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+.LC2:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+	
+/* float [fp1] roundf  (float x [fp1])
+   IEEE 1003.1 round 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
+   to the integer value.  */
+
+ENTRY(__roundf )
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsubs	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	lfd	fp10,.LC1@toc(2)
+	ble-	cr6,.L4
+	fadds	fp1,fp1,fp10	/* x+= 0.5;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L4:
+	fsubs	fp9,fp1,fp10	/* x+= 0.5;  */
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsubs	fp1,fp9,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__roundf )
+
+weak_alias(__roundf ,roundf )
+
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_trunc.S libc23/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_trunc.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_trunc.S	Fri Apr 23 11:39:52 2004
@@ -0,0 +1,67 @@
+/* trunc function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+.LC2:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+	
+/* double [fp1] trunc (double x [fp1])
+   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
+   value, in floating format, nearest to but no larger in magnitude 
+   then the argument."
+   We set "round toward Zero" mode and trunc by adding +-2**52 then
+   subtracting +-2**52.  */
+
+ENTRY(__trunc)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,1		/* Set rounding toward 0 mode.  */
+	ble-	cr6,.L4
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__trunc)
+
+weak_alias(__trunc,trunc)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__trunc,truncl)
+strong_alias(__trunc,__truncl)
+#endif
diff -urN libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_truncf.S libc23/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
--- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/s_truncf.S	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/fpu/s_truncf.S	Fri Apr 23 13:23:15 2004
@@ -0,0 +1,63 @@
+/* truncf function.  PowerPC64 version.
+   Copyright (C) 2004 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>
+
+	.section	".toc","aw"
+.LC0:	/* 2**23 */
+	.tc FD_41600000_0[TC],0x4160000000000000
+.LC2:	/* -0.0 */
+	.tc FD_80000000_0[TC],0x8000000000000000
+	.section	".text"
+	
+/* float [fp1] truncf (float x [fp1])
+   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
+   value, in floating format, nearest to but no larger in magnitude 
+   then the argument."
+   We set "round toward Zero" mode and trunc by adding +-2**23 then
+   subtracting +-2**23.  */
+
+ENTRY(__truncf)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fsubs	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnllr-	cr7
+	mtfsfi	7,1		/* Set rounding toward 0 mode.  */
+	ble-	cr6,.L4
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+.L9:	
+	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	blr
+.L4:
+	bge-	cr6,.L9		/* if (x < 0.0)  */
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	blr
+	END (__truncf)
+
+weak_alias(__truncf,truncf)
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]