Use ARM's faster math functions on non-tiny builds

This commit is contained in:
Justine Tunney 2022-07-11 18:34:10 -07:00
parent 3c10fb5580
commit 4814b6bdf8
58 changed files with 3760 additions and 361 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/math.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -54,3 +55,12 @@ TEST(logf, test) {
EXPECT_STREQ("-NAN", gc(xdtoaf(logf(-1))));
EXPECT_STREQ("-NAN", gc(xdtoaf(logf(-2))));
}
BENCH(logl, bench) {
double _log(double) asm("log");
float _logf(float) asm("logf");
long double _logl(long double) asm("logl");
EZBENCH2("log", donothing, _log(.7)); /* ~9ns */
EZBENCH2("logf", donothing, _logf(.7)); /* ~20ns */
EZBENCH2("logl", donothing, _logl(.7)); /* ~20ns */
}