This is the mail archive of the
mailing list for the GCC project.
Re: [libstdc++ patch] Check for __builtins in std_cmath.h
- From: Roger Sayle <roger at eyesopen dot com>
- To: Gabriel Dos Reis <gdr at codesourcery dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, <libstdc++ at gcc dot gnu dot org>
- Date: Sat, 29 Dec 2001 08:55:07 -0700 (MST)
- Subject: Re: [libstdc++ patch] Check for __builtins in std_cmath.h
> | This patch was originally developed as a possible solution to the
> | high priority PR libstdc++/3184. Just my luck, PR 3184 was closed
> | earlier today whilst this patch was being regression tested. It
> | does however protect against using __builtin functions on targets
> | that don't support them.
> I think we already discussed that matter in the past. If a target
> does not support a __builtin_xxx, then it falls back to a library xxx
> definition. libmath/stubs.c is the right place to put missing xxx
Wow! I hadn't appreciated that libstc++-v3 provided its own stub
implementations for missing libm functions. I agree this is a much
better place to fix the problem. It allows the builtin implementations
to be used even when a linkage is not provided by the system.
The hopefully obvious patch below fixes the cosf and sinf cases in
libstdc++-v3/libmath/stubs.c to reflect that strategy. This approach
also allows significant simplification in c_shadow/bits/std_cmath.h
where we can/should always call the __builtin function, this matches
how things are done in c_std/bits/std_cmath.h. Alas this independent
(and possibly controversial?) change is not so trivial so I'll run a
bootstrap (together with this patch) before submitting it.
Gaby, is this what you had in mind?
2001-12-29 Roger Sayle <email@example.com>
* libmath/stubs.c (sinf,cosf): Implement stubs to enable the
equivalent __builtin_ versions.
*** gcc/libstdc++-v3/libmath/stubs.c Tue Aug 14 00:50:58 2001
--- patch2/libstdc++-v3/libmath/stubs.c Sat Dec 29 08:43:10 2001
*************** atan2l(long double x, long double y)
*** 51,57 ****
! #if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF)
--- 51,57 ----
! #ifndef HAVE_COSF
*************** powl(long double x, long double y)
*** 186,192 ****
! #if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF)
--- 186,192 ----
! #ifndef HAVE_SINF
Roger Sayle, E-mail: firstname.lastname@example.org
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-438-3470