diff options
author | Szabolcs Nagy <nsz@port70.net> | 2017-10-22 18:32:47 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-04-17 23:44:01 -0400 |
commit | d28cd0ad428d63c186003fdf9c02470561650a04 (patch) | |
tree | 730d1899c26c3e6542d7937b496559c9485174d3 /src/math/powf_data.h | |
parent | 3f94c648ef32c95fa7f5c94b5cb8f2b764fc1938 (diff) | |
download | musl-d28cd0ad428d63c186003fdf9c02470561650a04.tar.gz musl-d28cd0ad428d63c186003fdf9c02470561650a04.tar.bz2 musl-d28cd0ad428d63c186003fdf9c02470561650a04.tar.xz musl-d28cd0ad428d63c186003fdf9c02470561650a04.zip |
math: new powf
from https://github.com/ARM-software/optimized-routines,
commit 04884bd04eac4b251da4026900010ea7d8850edc
POWF_SCALE != 1.0 case only matters if TOINT_INTRINSICS is set, which
is currently not supported for any target.
SNaN is not supported, it would require an issignalingf
implementation.
code size change: -816 bytes.
benchmark on x86_64 before, after, speedup:
-Os:
powf rthruput: 95.14 ns/call 20.04 ns/call 4.75x
powf latency: 137.00 ns/call 34.98 ns/call 3.92x
-O3:
powf rthruput: 92.48 ns/call 13.67 ns/call 6.77x
powf latency: 131.11 ns/call 35.15 ns/call 3.73x
Diffstat (limited to 'src/math/powf_data.h')
-rw-r--r-- | src/math/powf_data.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/math/powf_data.h b/src/math/powf_data.h new file mode 100644 index 00000000..5b136e28 --- /dev/null +++ b/src/math/powf_data.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017-2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ +#ifndef _POWF_DATA_H +#define _POWF_DATA_H + +#include "libm.h" +#include "exp2f_data.h" + +#define POWF_LOG2_TABLE_BITS 4 +#define POWF_LOG2_POLY_ORDER 5 +#if TOINT_INTRINSICS +#define POWF_SCALE_BITS EXP2F_TABLE_BITS +#else +#define POWF_SCALE_BITS 0 +#endif +#define POWF_SCALE ((double)(1 << POWF_SCALE_BITS)) +extern hidden const struct powf_log2_data { + struct { + double invc, logc; + } tab[1 << POWF_LOG2_TABLE_BITS]; + double poly[POWF_LOG2_POLY_ORDER]; +} __powf_log2_data; + +#endif |