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] math failures on s390*.


Hi,
the current head has some testcase failures for s390* in math/.
The attached patch updates the ulps file and adds support for the
sqrt instructions "sqdbr" and "sqebr". This fixes the testcase
failures. The C implementation for __ieee754_sqrt seems to have
a problem, it sets the FE_INVALID bit for sqrt(NaN) on s390*.
Didn't investigate further, its simpler to use the hardware
instructions which gets it right.

blue skies,
  Martin.

2004-04-22  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/fpu/e_sqrt.c: New file.
	* sysdeps/s390/fpu/e_sqrtf.c: New file.
	* sysdeps/s390/fpu/libm-test-ulps: Regenerate.
	* 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/fpu/libm-test-ulps libc-s390/sysdeps/s390/fpu/libm-test-ulps
--- libc/sysdeps/s390/fpu/libm-test-ulps	2003-12-05 14:29:26.000000000 +0100
+++ libc-s390/sysdeps/s390/fpu/libm-test-ulps	2004-04-22 13:18:05.000000000 +0200
@@ -1,6 +1,9 @@
 # Begin of automatic generation
 
 # atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994380":
+float: 6
+ifloat: 6
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
 float: 3
 ifloat: 3
@@ -10,9 +13,6 @@
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994380":
-float: 6
-ifloat: 6
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -261,9 +261,6 @@
 ifloat: 1
 
 # ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
@@ -287,6 +284,9 @@
 idouble: 1
 
 # erfc
+Test "erfc (0.75) == 0.288844366346484868401062165408589223":
+float: 1
+ifloat: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
@@ -359,9 +359,6 @@
 float: 1
 idouble: 2
 ifloat: 1
-Test "j0 (2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -396,9 +393,6 @@
 float: 1
 idouble: 2
 ifloat: 1
-Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -427,13 +421,11 @@
 idouble: 1
 ifloat: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 4
+float: 1
+ifloat: 1
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
 float: 3
-idouble: 4
 ifloat: 3
-Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 4
-ifloat: 4
 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
 double: 1
 float: 1
@@ -451,9 +443,9 @@
 ifloat: 1
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
-float: 2
+float: 1
 idouble: 1
-ifloat: 2
+ifloat: 1
 
 # lgamma
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
@@ -534,8 +526,13 @@
 idouble: 2
 ifloat: 1
 Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "y0 (2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
 Test "y0 (8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
@@ -547,7 +544,9 @@
 double: 1
 idouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
@@ -577,8 +576,13 @@
 idouble: 2
 ifloat: 1
 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
@@ -588,7 +592,9 @@
 double: 1
 idouble: 1
 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
@@ -610,27 +616,25 @@
 idouble: 1
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
-double: 1
-idouble: 1
+float: 2
+ifloat: 2
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 2
 idouble: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 double: 1
 idouble: 1
 Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-double: 1
 float: 1
-idouble: 1
 ifloat: 1
 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
@@ -780,10 +784,6 @@
 float: 1
 ifloat: 1
 
-Function: Real part of "ctan":
-double: 1
-idouble: 1
-
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
@@ -804,7 +804,9 @@
 
 Function: "erfc":
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 
 Function: "exp10":
 double: 6
@@ -824,9 +826,9 @@
 
 Function: "j0":
 double: 2
-float: 2
+float: 1
 idouble: 2
-ifloat: 2
+ifloat: 1
 
 Function: "j1":
 double: 1
@@ -835,10 +837,10 @@
 ifloat: 2
 
 Function: "jn":
-double: 4
-float: 4
-idouble: 4
-ifloat: 4
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
 
 Function: "lgamma":
 double: 1
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


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