[Bug libstdc++/11706] New: std::pow(T, int) implementation pessimizes code
rguenth at tat dot physik dot uni-tuebingen dot de
gcc-bugzilla@gcc.gnu.org
Tue Jul 29 12:03:00 GMT 2003
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.
More information about the Gcc-bugs
mailing list