about summary refs log tree commit diff
path: root/src/math/pow_data.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2018-12-01 01:09:01 +0000
committerRich Felker <dalias@aerifal.cx>2019-04-17 23:45:40 -0400
commite4dd65305a046019123ab34ebdcbe761a3a719ca (patch)
tree292797b26ebc4794828c8f7fd46b9a7ef7374bc7 /src/math/pow_data.h
parente16f7b3c02e17d0ace779a11f0d53a9c05fdd434 (diff)
downloadmusl-e4dd65305a046019123ab34ebdcbe761a3a719ca.tar.gz
musl-e4dd65305a046019123ab34ebdcbe761a3a719ca.tar.xz
musl-e4dd65305a046019123ab34ebdcbe761a3a719ca.zip
math: new pow
from https://github.com/ARM-software/optimized-routines,
commit 04884bd04eac4b251da4026900010ea7d8850edc

The underflow exception is signaled if the result is in the subnormal
range even if the result is exact.

code size change: +3421 bytes.
benchmark on x86_64 before, after, speedup:

-Os:
   pow rthruput: 102.96 ns/call 33.38 ns/call 3.08x
    pow latency: 144.37 ns/call 54.75 ns/call 2.64x
-O3:
   pow rthruput:  98.91 ns/call 32.79 ns/call 3.02x
    pow latency: 138.74 ns/call 53.78 ns/call 2.58x
Diffstat (limited to 'src/math/pow_data.h')
-rw-r--r--src/math/pow_data.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/math/pow_data.h b/src/math/pow_data.h
new file mode 100644
index 00000000..5d609ae8
--- /dev/null
+++ b/src/math/pow_data.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018, Arm Limited.
+ * SPDX-License-Identifier: MIT
+ */
+#ifndef _POW_DATA_H
+#define _POW_DATA_H
+
+#include <features.h>
+
+#define POW_LOG_TABLE_BITS 7
+#define POW_LOG_POLY_ORDER 8
+extern hidden const struct pow_log_data {
+	double ln2hi;
+	double ln2lo;
+	double poly[POW_LOG_POLY_ORDER - 1]; /* First coefficient is 1.  */
+	/* Note: the pad field is unused, but allows slightly faster indexing.  */
+	struct {
+		double invc, pad, logc, logctail;
+	} tab[1 << POW_LOG_TABLE_BITS];
+} __pow_log_data;
+
+#endif