This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/11706] std::pow(T, int) implementation pessimizes code


------- Additional Comments From gdr at integrable-solutions dot net  2003-12-06 20:33 -------
Subject: Re:  std::pow(T, int) implementation pessimizes code

"rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2003-12-06 20:05 -------
| Subject: Re:  std::pow(T, int) implementation pessimizes
|  code
| 
| On Sat, 5 Dec 2003, bkoz at gcc dot gnu dot org wrote:
| 
| > Can we get this resolved, folks? I think all that needs to be done now is
| > examine cmath.tcc for inline-ability (ie, is __cmath_power to be inlined now?)
| > Please let me know how I can help.
| 
| Ok, so I checked todays mainline and g++-3.3 (GCC) 3.3.3 20031114
| (prerelease), with gcc 3.3, for both, ::pow(x,2) and std::pow(x,2) we
| generate a call to libm, for mainline this is the same - except if we
| compile with -ffast-math, in which case the first call is expanded to
| optimal asm. So it seems this transformation is guarded with
| -funsafe-math-optimizations -- why?

I guess, it is because we don't trust the asm version of math
functions by default and use them only if -funsafe-math-optimizations.
There have been lengthy discussions in the past, and the general
decision was to generate asms onlyk if -funsafe-math-optimizations.

-- Gaby




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11706


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