[PATCH] Fix PR11706, use __builtin_powi[lf] for pow(x, int)

Richard Guenther rguenth@tat.physik.uni-tuebingen.de
Mon Feb 7 17:37:00 GMT 2005


On Mon, 7 Feb 2005, Paolo Carlini wrote:

> Richard Guenther wrote:
>
> >This patch will fix PR11706 once support for __builtin_powi goes in.
> >
> >Bootstrapped and tested on x86_64-unknown-linux-gnu.
> >
> >Ok for mainline?
> >
> This cannot be ok, because __pow_helper is used also for <complex>...

Indeed.  Weird that didn't show up during testing.  Grep'ing for
cmath.tcc also didn't show it because complex doesn't include it.

I'll re-test the following (very) simpler patch then.  Ok if
testing succeeds?

Thanks again,
Richard.

2005-02-07  Richard Guenther <rguenth@gcc.gnu.org>

	* include/c_std/std_cmath.h (pow): Use __builtin_powi[lf]
	for integer overloads.

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
*** 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;





More information about the Gcc-patches mailing list