diff options
author | Szabolcs Nagy <nsz@port70.net> | 2018-11-30 21:39:47 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-04-17 23:45:25 -0400 |
commit | e16f7b3c02e17d0ace779a11f0d53a9c05fdd434 (patch) | |
tree | f60943599162fe681d5753aa6744b471ec4193a9 /src/math/exp_data.h | |
parent | 2a3210cf4abff0a69ff3e7adc66591dfe6ab2197 (diff) | |
download | musl-e16f7b3c02e17d0ace779a11f0d53a9c05fdd434.tar.gz |
math: new exp and exp2
from https://github.com/ARM-software/optimized-routines,
commit 04884bd04eac4b251da4026900010ea7d8850edc
TOINT_INTRINSICS and EXP_USE_TOINT_NARROW cases are unused.
The underflow exception is signaled if the result is in the subnormal
range even if the result is exact (e.g. exp2(-1023.0)).
code size change: -1672 bytes.
benchmark on x86_64 before, after, speedup:
-Os:
exp rthruput: 12.73 ns/call 6.68 ns/call 1.91x
exp latency: 45.78 ns/call 21.79 ns/call 2.1x
exp2 rthruput: 6.35 ns/call 5.26 ns/call 1.21x
exp2 latency: 26.00 ns/call 16.58 ns/call 1.57x
-O3:
exp rthruput: 12.75 ns/call 6.73 ns/call 1.89x
exp latency: 45.91 ns/call 21.80 ns/call 2.11x
exp2 rthruput: 6.47 ns/call 5.40 ns/call 1.2x
exp2 latency: 26.03 ns/call 16.54 ns/call 1.57x
Diffstat (limited to 'src/math/exp_data.h')
-rw-r--r-- | src/math/exp_data.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/math/exp_data.h b/src/math/exp_data.h new file mode 100644 index 00000000..3e24bac5 --- /dev/null +++ b/src/math/exp_data.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ +#ifndef _EXP_DATA_H +#define _EXP_DATA_H + +#include <features.h> +#include <stdint.h> + +#define EXP_TABLE_BITS 7 +#define EXP_POLY_ORDER 5 +#define EXP_USE_TOINT_NARROW 0 +#define EXP2_POLY_ORDER 5 +extern hidden const struct exp_data { + double invln2N; + double shift; + double negln2hiN; + double negln2loN; + double poly[4]; /* Last four coefficients. */ + double exp2_shift; + double exp2_poly[EXP2_POLY_ORDER]; + uint64_t tab[2*(1 << EXP_TABLE_BITS)]; +} __exp_data; + +#endif |