summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/math_config.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2017-09-04 17:48:46 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2017-09-29 11:46:46 +0100
commitbf27d3973d75ed676ea0a0b0dae2fac367d7749b (patch)
treefc32d238bcc9d0440a2e1d0bfeb24eac8396e135 /sysdeps/ieee754/flt-32/math_config.h
parent4088d8dd29ce0629eeaa7cceca02414c85d98e05 (diff)
downloadglibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.tar.gz
glibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.tar.xz
glibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.zip
New generic logf
without wrapper on aarch64:
logf reciprocal-throughput: 2.2x faster
logf latency: 1.9x faster
old worst case error: 0.89 ulp
new worst case error: 0.82 ulp
aarch64 .text size: -356 bytes
aarch64 .rodata size: +240 bytes

Uses double precision arithmetics and a lookup table to allow smaller
polynomial and avoid the use of division.

Data is in a separate translation unit with fixed layout to prevent the
compiler generating suboptimal literal access.

Errors are handled inline according to POSIX rules, but this patch
keeps the wrapper with SVID compatible error handling.

Needs libm-test-ulps adjustment for clogf in non-nearest rounding mode.

	* math/Makefile (type-float-routines): Add e_logf_data.
	* sysdeps/ieee754/flt-32/e_logf.c: New implementation.
	* sysdeps/ieee754/flt-32/e_logf_data.c: New file.
	* sysdeps/ieee754/flt-32/math_config.h (__logf_data): Define.
	(LOGF_TABLE_BITS, LOGF_POLY_ORDER): Define.
	* sysdeps/i386/fpu/e_logf_data.c: New file.
	* sysdeps/ia64/fpu/e_logf_data.c: New file.
	* sysdeps/m68k/m680x0/fpu/e_logf_data.c: New file.
Diffstat (limited to 'sysdeps/ieee754/flt-32/math_config.h')
-rw-r--r--sysdeps/ieee754/flt-32/math_config.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/ieee754/flt-32/math_config.h b/sysdeps/ieee754/flt-32/math_config.h
index 31f0470612..953a4bc583 100644
--- a/sysdeps/ieee754/flt-32/math_config.h
+++ b/sysdeps/ieee754/flt-32/math_config.h
@@ -111,4 +111,16 @@ extern const struct exp2f_data
   double poly_scaled[EXP2F_POLY_ORDER];
 } __exp2f_data attribute_hidden;
 
+#define LOGF_TABLE_BITS 4
+#define LOGF_POLY_ORDER 4
+extern const struct logf_data
+{
+  struct
+  {
+    double invc, logc;
+  } tab[1 << LOGF_TABLE_BITS];
+  double ln2;
+  double poly[LOGF_POLY_ORDER - 1]; /* First order coefficient is 1.  */
+} __logf_data attribute_hidden;
+
 #endif