[PATCH] Fix PR11706, use __builtin_powi[lf] for pow(x, int)
Richard Guenther
rguenth@tat.physik.uni-tuebingen.de
Mon Feb 7 14:12:00 GMT 2005
This patch will fix PR11706 once support for __builtin_powi goes in.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Ok for mainline?
Thanks,
Richard.
2005-02-07 Richard Guenther <rguenth@gcc.gnu.org>
* include/Makefile.am (c_base_headers_extra): Remove cmath.tcc.
include/Makefile.in (c_base_headers_extra): Likewise.
include/c_std/std_cmath.h (__pow_helper): Remove.
(pow): Use __builtin_powi[lf] for integer overloads.
Do not include bits/cmath.tcc.
include/c_std/cmath.tcc: Remove.
Index: include/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.am,v
retrieving revision 1.92
diff -c -3 -p -r1.92 Makefile.am
*** include/Makefile.am 31 Jan 2005 16:21:31 -0000 1.92
--- include/Makefile.am 7 Feb 2005 13:46:02 -0000
*************** debug_headers = \
*** 332,338 ****
# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
if GLIBCXX_C_HEADERS_C_STD
! c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
else
c_base_headers_extra =
endif
--- 332,338 ----
# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
if GLIBCXX_C_HEADERS_C_STD
! c_base_headers_extra =
else
c_base_headers_extra =
endif
Index: include/Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.in,v
retrieving revision 1.121
diff -c -3 -p -r1.121 Makefile.in
*** include/Makefile.in 31 Jan 2005 16:21:40 -0000 1.121
--- include/Makefile.in 7 Feb 2005 13:46:02 -0000
*************** debug_headers = \
*** 552,558 ****
# Some of the different "C" header models need extra files.
# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
! @GLIBCXX_C_HEADERS_C_STD_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
--- 552,558 ----
# Some of the different "C" header models need extra files.
# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
! @GLIBCXX_C_HEADERS_C_STD_TRUE@c_base_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
Index: include/c_std/std_cmath.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/std_cmath.h,v
retrieving revision 1.17
diff -c -3 -p -r1.17 std_cmath.h
*** include/c_std/std_cmath.h 1 Feb 2005 13:30:32 -0000 1.17
--- include/c_std/std_cmath.h 7 Feb 2005 13:46:02 -0000
*************** namespace std
*** 329,343 ****
modf(long double __x, long double* __iptr)
{ return __builtin_modfl(__x, __iptr); }
- template<typename _Tp>
- inline _Tp
- __pow_helper(_Tp __x, int __n)
- {
- return __n < 0
- ? _Tp(1)/__cmath_power(__x, -__n)
- : __cmath_power(__x, __n);
- }
-
using ::pow;
inline float
--- 329,334 ----
*************** namespace std
*** 349,364 ****
{ return __builtin_powl(__x, __y); }
inline double
! pow(double __x, int __i)
! { return __pow_helper(__x, __i); }
inline float
pow(float __x, int __n)
! { return __pow_helper(__x, __n); }
inline long double
pow(long double __x, int __n)
! { return __pow_helper(__x, __n); }
using ::sin;
--- 340,355 ----
{ return __builtin_powl(__x, __y); }
inline double
! pow(double __x, int __n)
! { return __builtin_powi(__x, __n); }
inline float
pow(float __x, int __n)
! { return __builtin_powif(__x, __n); }
inline long double
pow(long double __x, int __n)
! { return __builtin_powil(__x, __n); }
using ::sin;
*************** namespace std
*** 570,577 ****
#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
#endif
- #ifndef _GLIBCXX_EXPORT_TEMPLATE
- # include <bits/cmath.tcc>
- #endif
-
#endif
--- 561,564 ----
More information about the Libstdc++
mailing list