This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/48092] associative property of builtins is not exploited on GIMPLE
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Sep 2011 10:50:46 +0000
- Subject: [Bug tree-optimization/48092] associative property of builtins is not exploited on GIMPLE
- Auto-submitted: auto-generated
- References: <bug-48092-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48092
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 2011-09-08 10:50:46 UTC ---
On Thu, 8 Sep 2011, vincenzo.innocente at cern dot ch wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48092
>
> --- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2011-09-08 10:01:48 UTC ---
> btw even in C with -Ofast
> a*exp(x)*exp(y) (same for sqrt) is NOT optimized. compare
>
> double exp0(double x, double y) {
> return exp(x)*exp(y);
> }
>
> double exp1(double a, double x, double y) {
> return a*exp(x)*exp(y);
> }
Yes, that's because those simplification all are implemented in
fold-const.c. Compare
double exp03(double a, double x, double y) {
double tmp1 = exp(x);
double tmp2 = exp(y);
return a*(tmp1*tmp2);
}
and in fold-const.c we don't associate FP math. tree-ssa-reassoc.c
re-associates exp1, but then the simplification is missing - see
my exp03 example.