This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR11706, optimize std::pow(T, int)


Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:

[...]

| > And, after Zdenek nice patch, -funroll-loops should lead to optimal code.
| > Does it work as expected?
| 
| Yes, __cmath_power is inlined and -funroll-loops is able to optimize
| the loop for constant powers.  Though the approach in __cmath_power
| is not optimal, f.i. for a exponent of 27 we generate one more
| multiplication than with __builtin_pow().  Also, as we inline
| __cmath_power all the time now, we have icache and code-size regressions
| for not constant powers.  With my hackish approach we could again
| remove these inlines.  Also, having to enable -funroll-loops to

So, what you want is to have the compiler better understand loop with
"constant" bounds, without requiring -funroll-loops.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]