from https://github.com/ARM-software/optimized-routines, commit 04884bd04eac4b251da4026900010ea7d8850edc, with minor changes to better fit into musl. code size change: +289 bytes. benchmark on x86_64 before, after, speedup: -Os: logf rthruput: 8.40 ns/call 6.14 ns/call 1.37x logf latency: 31.79 ns/call 24.33 ns/call 1.31x -O3: logf rthruput: 8.43 ns/call 5.58 ns/call 1.51x logf latency: 32.04 ns/call 20.88 ns/call 1.53x
21 lines
406 B
C
21 lines
406 B
C
/*
|
|
* Copyright (c) 2017-2018, Arm Limited.
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
#ifndef _LOGF_DATA_H
|
|
#define _LOGF_DATA_H
|
|
|
|
#include <features.h>
|
|
|
|
#define LOGF_TABLE_BITS 4
|
|
#define LOGF_POLY_ORDER 4
|
|
extern hidden 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;
|
|
|
|
#endif
|