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"
@ -53,3 +54,12 @@ TEST(truncl, test) {
EXPECT_STREQ("INFINITY", gc(xdtoal(truncl(INFINITY))));
EXPECT_STREQ("-INFINITY", gc(xdtoal(truncl(-INFINITY))));
}
BENCH(truncl, bench) {
double _trunc(double) asm("trunc");
float _truncf(float) asm("truncf");
long double _truncl(long double) asm("truncl");
EZBENCH2("trunc", donothing, _trunc(.7)); /* ~2ns */
EZBENCH2("truncf", donothing, _truncf(.7)); /* ~2ns */
EZBENCH2("truncl", donothing, _truncl(.7)); /* ~9ns */
}