This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 to add builtin log2, log10, exp2, exp10/pow10 optimizations


Kaveh R. Ghazi wrote:
This patch generalizes the builtin exp/log optimizations so that we
can also apply them to log2, log10, exp2 and exp10/pow10

There are two places where you use dconste without testing builtin_dconst_init first.


In fold_builtin_logarithm, you dropped some useful comments in the section that generalizes log*(func()). The old code has these comments, but the new one doesn't.
/* Optimize log(sqrt(x)) = log(x)*0.5. */
/* Optimize log(pow(x,y)) = y*log(x). */
These comments plus more comments for the other transforms makes this code easier to understand.


dconstthird isn't exactly representable unlike the other values. I'm wondering if it is safe to compute it with a divide, and perform optimizations based on this value. I can't think of any reason why this won't work though.

Otherwise it looks OK to me.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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