about summary refs log tree commit diff
path: root/src/math/log2f_data.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2017-10-22 17:39:36 +0000
committerRich Felker <dalias@aerifal.cx>2019-04-17 23:43:43 -0400
commit098868b338e9afd3ef844070a94b9b10360d913f (patch)
tree423730a900d0e74311a945fc014d961d3ba1d6ba /src/math/log2f_data.h
parentdb505b794c697631f65e6b91ff106496debb86ac (diff)
downloadmusl-098868b338e9afd3ef844070a94b9b10360d913f.tar.gz
musl-098868b338e9afd3ef844070a94b9b10360d913f.tar.xz
musl-098868b338e9afd3ef844070a94b9b10360d913f.zip
math: new log2f
from https://github.com/ARM-software/optimized-routines,
commit 04884bd04eac4b251da4026900010ea7d8850edc

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

-Os:
 log2f rthruput:  11.38 ns/call  5.99 ns/call 1.9x
  log2f latency:  35.01 ns/call 22.57 ns/call 1.55x
-O3:
 log2f rthruput:  10.82 ns/call  5.58 ns/call 1.94x
  log2f latency:  35.13 ns/call 21.04 ns/call 1.67x
Diffstat (limited to 'src/math/log2f_data.h')
-rw-r--r--src/math/log2f_data.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/math/log2f_data.h b/src/math/log2f_data.h
new file mode 100644
index 00000000..4fa48956
--- /dev/null
+++ b/src/math/log2f_data.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017-2018, Arm Limited.
+ * SPDX-License-Identifier: MIT
+ */
+#ifndef _LOG2F_DATA_H
+#define _LOG2F_DATA_H
+
+#include <features.h>
+
+#define LOG2F_TABLE_BITS 4
+#define LOG2F_POLY_ORDER 4
+extern hidden const struct log2f_data {
+	struct {
+		double invc, logc;
+	} tab[1 << LOG2F_TABLE_BITS];
+	double poly[LOG2F_POLY_ORDER];
+} __log2f_data;
+
+#endif