------- Comment #43 from dominiq at lps dot ens dot fr  2010-03-16 16:38 -------
> log, exp?  What code are you looking at now?

AFAIK all pow(a,b) boils down to exp(b*log(a)), unless special values: n,
n/2.0, n/3.0, ... for 'b' are handled in a different way.

So from what I know about coding, replacing pow(a,b) with multiplications,
sqrt, and cbrt is almost always a win for speed (as shown by this pr, although
you can probably write corner cases for which it may be not true). For size,
the matter is more complicated and may depend on the use or not of exp and log
in other parts of the program (how compact they are, are static or not, ...),
thus I doubt that replacing x*sqrt(x) with pow(x,1.5) is always a win for size,
even for embedded systems with soft-floats.

It seems to me that controlling the constant exponents through a maximum
integer (instead of POWI_MAX_MULTS) depending on the kind of optimization and
the target would be a better solution
than n==1||optimize_insn_for_speed_p ().


-- 


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

Reply via email to