This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/11706] New: std::pow(T, int) implementation pessimizes code
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2003 12:03:29 -0000
- Subject: [Bug libstdc++/11706] New: std::pow(T, int) implementation pessimizes code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11706
Summary: std::pow(T, int) implementation pessimizes code
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
The std::__pow_helper() implementation ends up emitting a call to
std::__cmath_power() for all constant powers as f.i. in the call to
std::pow(x, 2). This severly pessimizes code and can be cured by teaching
optimal computation to std::__pow_helper() via the __builtin_constant_p
mechanism of gcc.
See http://gcc.gnu.org/ml/gcc/2003-07/msg01950.html for an example improved
implementation.
The same problem exists on the 3.3 branch.