This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/64225] -funsafe-math-optimizations generates call to pow where multiply instruction would do
- From: "ktkachov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Dec 2014 15:56:46 +0000
- Subject: [Bug middle-end/64225] -funsafe-math-optimizations generates call to pow where multiply instruction would do
- Auto-submitted: auto-generated
- References: <bug-64225-4 at http dot gcc dot gnu dot org/bugzilla/>
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?