Get libc/tinymath/ compiling on aarch64

This commit is contained in:
Justine Tunney 2023-05-02 18:35:25 -07:00
parent 2b73e72d59
commit 135080fd3e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
243 changed files with 7773 additions and 4027 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/math.h"
#include "libc/mem/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -48,3 +49,12 @@ TEST(sqrtf, test) {
EXPECT_STREQ("INFINITY", gc(xdtoaf(sqrtf(INFINITY))));
EXPECT_STREQ("-NAN", gc(xdtoaf(sqrtf(-1))));
}
BENCH(sqrt, bench) {
double _sqrt(double) asm("sqrt");
float _sqrtf(float) asm("sqrtf");
long double _sqrtl(long double) asm("sqrtl");
EZBENCH2("sqrt", donothing, _sqrt(.7)); /* ~5ns */
EZBENCH2("sqrtf", donothing, _sqrtf(.7)); /* ~5ns */
EZBENCH2("sqrtl", donothing, _sqrtl(.7)); /* ~28ns */
}