[Bug middle-end/64225] -funsafe-math-optimizations generates call to pow where multiply instruction would do

ktkachov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 8 15:56:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64225

--- Comment #7 from ktkachov at gcc dot gnu.org ---
(In reply to ktkachov from comment #6)
> fold-const.c has a comment in the relevant case that says:
>  /* Canonicalize x*x as pow(x,2.0), which is expanded as x*x.  */

I think this comment is misleading.
In builtins.c the expand_builtin_mathfn_2 handles the expansion of pow and I
don't see any code to expand pow (x, 2.0) as x * x. It tries to use the pow
optab, so unless the backend explicitly expands the case in such a manner, it
will not be converted to x*x.

Is there some other place in the compiler that plays a role here?



More information about the Gcc-bugs mailing list