patches/glibc/2.9/180-math-tests.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 22:43:07 2011 +0200 (2011-07-17)
changeset 2893 a8a65758664f
parent 1201 c9967a6e3b25
permissions -rw-r--r--
cc/gcc: do not use the core pass-2 to build the baremetal compiler

In case we build a baremetal compiler, use the standard passes:
- core_cc is used to build the C library;
- as such, it is meant to run on build, not host;
- the final compiler is meant to run on host;

As the current final compiler step can not build a baremetal compiler,
call the core backend from the final step.

NB: Currently, newlib is built during the start_files pass, so we have
to have a core compiler by then... Once we can build the baremetal
compiler from the final cc step, then we can move the newlib build to
the proper step, and then get rid of the core pass-1 static compiler...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 Original patch from: gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch
     2 
     3 -= BEGIN original header =-
     4 From: "Joseph S. Myers" <joseph at codesourcery dot com>
     5 To: libc-alpha at sourceware dot org
     6 Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC)
     7 Subject: expm1 ulps
     8 
     9 If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure:
    10 
    11 Failure: Test: expm1 (1) == M_El - 1.0
    12 Result:
    13  is:          1.71828182845904523532e+00   0xd.bf0a8b14576953500000p-3
    14  should be:   1.71828182845904523543e+00   0xd.bf0a8b14576953600000p-3
    15  difference:  1.08420217248550443401e-19   0x8.00000000000000000000p-66
    16  ulp       :  1.0000
    17  max.ulp   :  0.0000
    18 Maximal error of `expm1'
    19  is      : 1 ulp
    20  accepted: 0 ulp
    21 
    22 What happens is that the inline expansion of expm1l uses __builtin_expm1l,
    23 and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to
    24 a correctly rounded result using MPFR.  The result returned is thus the
    25 value of e-1 rounded once to long double precision.  However, the test
    26 expects M_El - 1.0, and the result of rounding e to long double precision,
    27 then subtracting 1, differs in the last place from the result of rounding
    28 e-1 to long double precision (the latter has smaller exponent, and the
    29 last bit is 1).
    30 
    31 There are two obvious approaches possible to fixing this.  The first patch
    32 below changes the expectation to a decimal expansion for e-1 (taken from
    33 that of M_El) rather than doing arithmetic in the expected value.  This in
    34 turn requires ulps to be set for the out-of-line version of expm1.  It
    35 might also need ulps to be set for the inline version for older compilers
    36 if they should continue to pass the test, and possibly for other targets.
    37 The second patch below takes the alternative approach of keeping the
    38 existing expectation (which has the wrong bit in the last place) and
    39 setting ulps for the inline expansion of expm1, which avoids the risk of
    40 breaking the test for other targets.
    41 
    42 2008-07-15  Joseph Myers  <joseph@codesourcery.com>
    43 
    44         * sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for
    45         expm1.
    46 
    47 -= END original header =-
    48 
    49 diff -durN glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps glibc-2_9/sysdeps/i386/fpu/libm-test-ulps
    50 --- glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps	2006-01-15 18:59:37.000000000 +0100
    51 +++ glibc-2_9/sysdeps/i386/fpu/libm-test-ulps	2009-02-02 22:00:47.000000000 +0100
    52 @@ -453,6 +453,10 @@
    53  ildouble: 8
    54  ldouble: 8
    55  
    56 +# expm1
    57 +Test "expm1 (1) == M_El - 1.0":
    58 +ildouble: 1
    59 +
    60  # gamma
    61  Test "gamma (-0.5) == log(2*sqrt(pi))":
    62  double: 1
    63 @@ -1134,6 +1138,9 @@
    64  ildouble: 8
    65  ldouble: 8
    66  
    67 +Function: "expm1":
    68 +ildouble: 1
    69 +
    70  Function: "gamma":
    71  double: 1
    72  idouble: 1