Bug 41098 - We should be better in folding pow with integer powers
Summary: We should be better in folding pow with integer powers
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization, xfail
Depends on:
Blocks:
 
Reported: 2009-08-18 09:51 UTC by Richard Biener
Modified: 2017-02-07 23:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-02-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2009-08-18 09:51:15 UTC
There are a bunch of missed-optimizations in fold_builtin_pow where we restrict
foldings to cases of non-negative base even when the power is an integer.

One source of easy missed optimizations is that fold folds x * x to pow (x, 2.0)
instead of powi (x, 2) which would make further analysis easier.
Comment 1 Richard Biener 2009-08-18 10:55:44 UTC
I have to XFAIL parts of gcc.dg/builtins-10.c because of PR41094.
Comment 2 Martin Sebor 2017-02-07 23:28:52 UTC
The XFAIL is still in the test and replacing it with linker_error() makes the test fail, so it looks like the optimization opportunities are still there.  I note that since r229408 fold_builtin_pow doesn't exist anymore as the logic was  moved to fold_const_builtin_pow and match.pd.