Re: [PATCH v2] Simplify pow with constant

2017-08-25 Thread Wilco Dijkstra
Jeff Law wrote: > Right.  exp is painful in glibc, but pow is *dramatically* more painful > and likely always will be. > > Siddhesh did some great work in bringing those costs down in glibc but > the more code we can reasonably shunt into exp instead of pow, the better. > > It's likely pow will

Re: [PATCH v2] Simplify pow with constant

2017-08-24 Thread Jeff Law
On 08/17/2017 09:43 AM, Alexander Monakov wrote: > On Thu, 17 Aug 2017, Wilco Dijkstra wrote: > >> This patch simplifies pow (C, x) into exp (x * C1) if C > 0, C1 = log (C). > > Note this changes the outcome for C == +Inf, x == 0 (pow is specified to > return 1.0 in that case, but x * C1 ==

Re: [PATCH v2] Simplify pow with constant

2017-08-24 Thread Jeff Law
On 08/17/2017 07:56 AM, Wilco Dijkstra wrote: > This patch simplifies pow (C, x) into exp (x * C1) if C > 0, C1 = log (C). > Do this only for fast-math as accuracy is reduced. This is much faster > since pow is more complex than exp - with current GLIBC the speedup is > more than 7 times for this

Re: [PATCH v2] Simplify pow with constant

2017-08-18 Thread Richard Biener
On Fri, Aug 18, 2017 at 2:47 PM, Wilco Dijkstra wrote: > Alexander Monakov wrote: >> >> Note this changes the outcome for C == +Inf, x == 0 (pow is specified to >> return 1.0 in that case, but x * C1 == NaN). There's another existing >> transform with the same issue,

Re: [PATCH v2] Simplify pow with constant

2017-08-18 Thread Wilco Dijkstra
Alexander Monakov wrote: > > Note this changes the outcome for C == +Inf, x == 0 (pow is specified to > return 1.0 in that case, but x * C1 == NaN).  There's another existing > transform with the same issue, 'pow(expN(x), y) -> expN(x*y)', so this is > not a new problem. > > The whole set of these

Re: [PATCH v2] Simplify pow with constant

2017-08-18 Thread Richard Biener
On Thu, Aug 17, 2017 at 5:43 PM, Alexander Monakov wrote: > On Thu, 17 Aug 2017, Wilco Dijkstra wrote: > >> This patch simplifies pow (C, x) into exp (x * C1) if C > 0, C1 = log (C). > > Note this changes the outcome for C == +Inf, x == 0 (pow is specified to > return 1.0 in

Re: [PATCH v2] Simplify pow with constant

2017-08-17 Thread Alexander Monakov
On Thu, 17 Aug 2017, Wilco Dijkstra wrote: > This patch simplifies pow (C, x) into exp (x * C1) if C > 0, C1 = log (C). Note this changes the outcome for C == +Inf, x == 0 (pow is specified to return 1.0 in that case, but x * C1 == NaN). There's another existing transform with the same issue,

Re: [PATCH v2] Simplify pow with constant

2017-08-17 Thread Wilco Dijkstra
This patch simplifies pow (C, x) into exp (x * C1) if C > 0, C1 = log (C). Do this only for fast-math as accuracy is reduced. This is much faster since pow is more complex than exp - with current GLIBC the speedup is more than 7 times for this transformation. The worst-case ULP error of the