[PATCH] use hw instructions for ieee754_sqrt on s390.
Martin Schwidefsky
schwidefsky@de.ibm.com
Fri Jun 11 17:03:00 GMT 2004
Hi,
use the hardware square root instructions sqdbr and sqebr
for __ieee754_sqrt and __ieee754_sqrtf. They are faster
than the generic C implementation.
blue skies,
Martin.
2004-06-11 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/fpu/e_sqrt.c: New file.
* sysdeps/s390/fpu/e_sqrtf.c: New file.
* sysdeps/s390/Implies: New file.
* sysdeps/s390/s390-32/Implies: Remove ieee754, move
ieee754/dbl-64 and ieee754/flt-32 to s390/s390/Implies.
* sysdeps/s390/s390-64/Implies: Likewise.
diff -urN libc/sysdeps/s390/fpu/e_sqrt.c libc-s390/sysdeps/s390/fpu/e_sqrt.c
--- libc/sysdeps/s390/fpu/e_sqrt.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-s390/sysdeps/s390/fpu/e_sqrt.c 2004-04-22 13:18:05.000000000 +0200
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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 <math_private.h>
+
+double
+__ieee754_sqrt (double x)
+{
+ double res;
+
+ asm ( "sqdbr %0,%1" : "=f" (res) : "f" (x) );
+ return res;
+}
diff -urN libc/sysdeps/s390/fpu/e_sqrtf.c libc-s390/sysdeps/s390/fpu/e_sqrtf.c
--- libc/sysdeps/s390/fpu/e_sqrtf.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-s390/sysdeps/s390/fpu/e_sqrtf.c 2004-04-22 13:18:05.000000000 +0200
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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 <math_private.h>
+
+float
+__ieee754_sqrtf (float x)
+{
+ float res;
+
+ asm ( "sqebr %0,%1" : "=f" (res) : "f" (x) );
+ return res;
+}
diff -urN libc/sysdeps/s390/Implies libc-s390/sysdeps/s390/Implies
--- libc/sysdeps/s390/Implies 1970-01-01 01:00:00.000000000 +0100
+++ libc-s390/sysdeps/s390/Implies 2004-04-22 13:18:05.000000000 +0200
@@ -0,0 +1,2 @@
+ieee754/dbl-64
+ieee754/flt-32
diff -urN libc/sysdeps/s390/s390-32/Implies libc-s390/sysdeps/s390/s390-32/Implies
--- libc/sysdeps/s390/s390-32/Implies 2001-03-16 09:59:32.000000000 +0100
+++ libc-s390/sysdeps/s390/s390-32/Implies 2004-04-22 13:18:05.000000000 +0200
@@ -1,4 +1 @@
wordsize-32
-ieee754
-ieee754/dbl-64
-ieee754/flt-32
diff -urN libc/sysdeps/s390/s390-64/Implies libc-s390/sysdeps/s390/s390-64/Implies
--- libc/sysdeps/s390/s390-64/Implies 2001-03-16 10:10:36.000000000 +0100
+++ libc-s390/sysdeps/s390/s390-64/Implies 2004-04-22 13:18:05.000000000 +0200
@@ -1,4 +1 @@
wordsize-64
-ieee754
-ieee754/dbl-64
-ieee754/flt-32
More information about the Libc-alpha
mailing list