[PATCH][PING] Fix PR25620, pow() expansion missed-optimization, 3rd try

Roger Sayle roger@eyesopen.com
Sun Nov 26 22:43:00 GMT 2006

On Sun, 26 Nov 2006, Richard Guenther wrote:
> 2006-11-13  Richard Guenther  <rguenther@suse.de>
> 	PR middle-end/25620
> 	* builtins.c (expand_builtin_pow): Optimize non integer valued
> 	constant exponents using sqrt or cbrt if possible.  Always fall back
> 	to expanding via optabs.
> 	* gcc.target/i386/pow-1.c: New testcase.
> 	* gcc.dg/builtins-58.c: Likewise.

This is OK for mainline.

> I also removed the restriction on unsafe_math for the fallback from
> expand_builtin_pow - Roger dded that back in 2004 but unfortunately the
> mailinglist archives for that year are corrupt, so I cannot figure out
> why, but I cannot think of any reason.

I've been doing some archeology and I suspect that the reason was
probably related to errno handling for pow, though the testing for
flag_unsafe_math_optimizations has jumped around in the code
significantly over time.  I think there's no problem to now always
fall back to expand_builtin_mathfn_2 which presumably should
contain it's own checks for -ferrno-math and the backend's powdf3
expanders should contain their own flag_unsafe_math_optimization
checks, if necessary.

Sorry for the delay.  Thanks for making the necessary revisions.


More information about the Gcc-patches mailing list