[PATCH] math: remove exp10 wrappers
Szabolcs Nagy
Szabolcs.Nagy@arm.com
Thu Jan 18 15:30:53 GMT 2024
The 01/18/2024 14:26, Wilco Dijkstra wrote:
> Hi Adhemerval,
>
> >> if that's the case then indeed using float/double directly
> >> may be better than float_t/double_t (but keep in mind if
> >> somebody builds the code outside the glibc tree to do
> >> tests or other analysis the behaviour will be fragile on
> >> targets like i386 and m68k. same if we ever want to change
> >> the glibc build flags to iso c mode on those targets.)
> >
> > My plan is to send some fixes to allow remove some remaining assembly
> > implementations from i386. I don't think it would worth to change
> > the current code besides the numerical stability I have found.
>
> I agree doing the fixes first (eg. by adding a cast to double) is best.
> Improving the macro to do this automatically may be an idea.
>
> In my measurements on exp10, using double instead of double_t was
> 22% faster (due to fewer store-load sequences). With -fpmath=sse it
> is 36% faster (LLVM does that by default). So given GCC prefers double
> and LLVM uses faster SSE already, there doesn't appear to be any benefit
> from supporting double_t.
the benefit is portability to standard conform modes.
my understanding is that 'fast' excess precision handling is
opportunistic, so the behaviour is different depending on where
the compiler decided to spill registers (and thus introduce an
intermediate rounding). this is not the end of the world (similar
to fma contraction) so for glibc it may be better to use double
and float exclusively. i guess we can do this by changing double_t
to xdouble_t in the code and typedef that to double.
(i would not change the code to use double, because that loses the
information about which variables may use excess precision.)
More information about the Libc-alpha
mailing list