[PATCH] PPC64 Use hardware sqrt.

Kumar Gala kumar.gala@freescale.com
Thu Apr 29 22:55:00 GMT 2004


I do not think its fair to say that all future PPC64 processors will 
implement the fsqrt instruction.

- kumar

On Apr 29, 2004, at 11:16 AM, Steve Munroe wrote:

> w_sqrt and w_sqrtf coded in assembler to take advantage of the 
> "optional instruction" fsqrt, which is implememented for all PPC64 
> processors.
>
> 2004-04-29  Steven Munroe  <sjmunroe@us.ibm.com>
> 	* sysdeps/powerpc/powerpc64/fpu/w_sqrt.S: New file.
> 	* sysdeps/powerpc/powerpc64/fpu/w_sqrtf.S: New file.
> diff -urN 
> libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/w_sqrt.S 
> libc23/sysdeps/powerpc/powerpc64/fpu/w_sqrt.S
> --- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/w_sqrt.S	Wed 
> Dec 31 17:00:00 1969
> +++ libc23/sysdeps/powerpc/powerpc64/fpu/w_sqrt.S	Fri Apr 23 15:01:21 
> 2004
> @@ -0,0 +1,39 @@
> +/* Double square root.  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 to take advantage of the "optional
> +   instruction" fsqrt, which is implememented for all PPC64 
> processors.  */
> +
> +#include <sysdep.h>
> +
> +ENTRY(__sqrt)
> +	fsqrt   fp1,fp1
> +	blr
> +	END (__sqrt)
> +
> +weak_alias(__sqrt,sqrt)
> +
> +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is
> +   used will not pass in a negative result.  */
> +strong_alias(__sqrt,__ieee754_sqrt)
> +
> +#ifdef NO_LONG_DOUBLE
> +weak_alias(__sqrt,sqrtl)
> +strong_alias(__sqrt,__sqrtl)
> +#endif
> diff -urN 
> libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/w_sqrtf.S 
> libc23/sysdeps/powerpc/powerpc64/fpu/w_sqrtf.S
> --- libc23-cvstip-20040412/sysdeps/powerpc/powerpc64/fpu/w_sqrtf.S	Wed 
> Dec 31 17:00:00 1969
> +++ libc23/sysdeps/powerpc/powerpc64/fpu/w_sqrtf.S	Fri Apr 23 15:02:29 
> 2004
> @@ -0,0 +1,35 @@
> +/* Float square root.  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 to take advantage of the "optional
> +   instruction" fsqrts, which is implememented for all PPC64 
> processors.  */
> +
> +#include <sysdep.h>
> +
> +ENTRY(__sqrtf)
> +	fsqrts  fp1,fp1
> +	blr
> +	END (__sqrtf)
> +
> +weak_alias(__sqrtf,sqrtf)
> +
> +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is
> +   used will not pass in a negative result.  */
> +strong_alias(__sqrtf,__ieee754_sqrtf)
> +



More information about the Libc-alpha mailing list