This is the mail archive of the libc-alpha@sourceware.org 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]

Build all of glibc with -frounding-math


As discussed in "[PATCH] Use -frounding-math for math testsuite", here's
a patch to build all of glibc with -frounding-math.

Tested on Linux/x86-64 and Linux/x86.

I checked on x86-64 that ldconfig, localedef, libpthread and libresolv
produced the same code as before.

On x86-64 I got these new ULPs with test-float (and ifloat):

testing float (without inline functions)
Failure: Test: acos_towardzero (0) == pi/2
Result:
 is:          1.57079625129699707031e+00   0x1.921fb400000000000000p+0
 should be:   1.57079637050628662109e+00   0x1.921fb600000000000000p+0
 difference:  1.19209289550781250000e-07   0x1.00000000000000000000p-23
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acos_towardzero (-0) == pi/2
Result:
 is:          1.57079625129699707031e+00   0x1.921fb400000000000000p+0
 should be:   1.57079637050628662109e+00   0x1.921fb600000000000000p+0
 difference:  1.19209289550781250000e-07   0x1.00000000000000000000p-23
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acos_towardzero (-1) == pi
Result:
 is:          3.14159250259399414062e+00   0x1.921fb400000000000000p+1
 should be:   3.14159274101257324219e+00   0x1.921fb600000000000000p+1
 difference:  2.38418579101562500000e-07   0x1.00000000000000000000p-22
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acos_downward (0) == pi/2
Result:
 is:          1.57079625129699707031e+00   0x1.921fb400000000000000p+0
 should be:   1.57079637050628662109e+00   0x1.921fb600000000000000p+0
 difference:  1.19209289550781250000e-07   0x1.00000000000000000000p-23
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acos_downward (-0) == pi/2
Result:
 is:          1.57079625129699707031e+00   0x1.921fb400000000000000p+0
 should be:   1.57079637050628662109e+00   0x1.921fb600000000000000p+0
 difference:  1.19209289550781250000e-07   0x1.00000000000000000000p-23
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acos_downward (-1) == pi
Result:
 is:          3.14159250259399414062e+00   0x1.921fb400000000000000p+1
 should be:   3.14159274101257324219e+00   0x1.921fb600000000000000p+1
 difference:  2.38418579101562500000e-07   0x1.00000000000000000000p-22
 ulp       :  1.0000
 max.ulp   :  0.0000

Ok to commit?

I'll do a followup to fix the testsuite if this is ok,

Andreas

2012-05-04  Andreas Jaeger  <aj@suse.de>

	* Makeconfig (+math-flags): New, set to -frounding-math.
	(+cflags): Add +math-flags so that all of glibc gets compiled with
	it.

diff --git a/Makeconfig b/Makeconfig
index 5c78ee4..f68a752 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -574,6 +574,11 @@ endif
 # actually different, so allow the compiler to merge them all.
 +merge-constants = -fmerge-all-constants
 
+# We have to assume that glibc functions are called in any rounding
+# mode and also change the rounding mode in a few functions. So,
+# disable any optimization that assume default rounding mode.
++math-flags = -frounding-math
+
 # This is the program that generates makefile dependencies from C source files.
 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
 # targets for headers so that removed headers don't break the build.
@@ -633,7 +638,7 @@ ifeq	"$(strip $(+cflags))" ""
 +cflags	:= $(default_cflags)
 endif	# $(+cflags) == ""
 
-+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
 +gcc-nowarn := -w
 
 # Don't duplicate options if we inherited variables from the parent.

-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix ImendÃrffer,HRB16746 (AG NÃrnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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