[RFC][PATCH] New expf, exp2f, logf, log2f and powf implementations

Wilco Dijkstra Wilco.Dijkstra@arm.com
Tue Sep 5 08:39:00 GMT 2017


Hi,

> Any comment on the difference in code and data size? Just curious
> if we are considering it on all targets.

When statically linking with GLIBC, I noticed text size of binaries using
Szabolc's patch was around 1200 bytes smaller on AArch64 when using
expf, logf and powf. Newlib uses an almost identical fdlibm version so the
savings should be similar. Compile it on your favourite target, YMMV.

> What capabilities does it require of the target architecture? You
> mentioned VFP. Does it require vector operations. If something
> is assumed, if the minimum capabilities are not met, how well
> does this code perform?

Very little, if double precision operations have similar performance as
single precision, you will get a huge speedup. The source is standard C99
so it doesn't require any vector extensions. What is required is decent
support for uint64_t, so it works best on 32/64-bit ISAs.

For 8/16-bit ISAs or CPUs without hardware floating point you generally
have to use integer arithmetic using a fast 32x32->64 bit multiplier, but
that requires a different algorithm. If your CPU doesn't have a multiplier(!?!)
then CORDIC is your only option. However newlib isn't optimizing for these
targets today, so this patch isn't aiming to either.

Mixed-endian IEEE formats could be supported but the various asuint()
functions would need porting (same for issignaling). Non-IEEE formats would
be harder given the use of integer masking to manipulate floating point values.

Wilco


More information about the Newlib mailing list