This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] v11 Improves __ieee754_exp() performance by greater than 5x on sparc/x86.


On 02/02/18 15:33, Joseph Myers wrote:
On Fri, 2 Feb 2018, Szabolcs Nagy wrote:

(i also removed the rounding mode settings in both cases
as that can be avoided at least on aarch64)

There is or was certainly code in the existing exp that gives completely
wrong results in non-default rounding modes (that was bug 3976) - e.g.
using precision-extension techniques that require round-to-nearest -
though I don't know if that applies to the fast case code or if it's only
in code for slow cases (or code for slow cases but using other rounding
modes results in the slow cases getting used much more).


that's because in the arg reduction rounding is done like

    y = x * log2e.x + three51.x;
    bexp = y - three51.x;
    ...
    y = t + three33.x;
    base = y - three33.x;

but if instead of x+shift-shift a rounding mode independent
instruction is used then there should be no huge error,
this should be possible at least on aarch64, but even on
other targets a rounding mode independent trunc(x+0.5) may
be faster than using fenv.

i think that exp can be implemented without fenv access
and with acceptable error in non-nearest rounding.


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