Port a lot more code to AARCH64

- Introduce epoll_pwait()
- Rewrite -ftrapv and ffs() libraries in C code
- Use more FreeBSD code in math function library
- Get significantly more tests passing on qemu-aarch64
- Fix many Musl long double functions that were broken on AARCH64
This commit is contained in:
Justine Tunney 2023-05-14 09:32:15 -07:00
parent 91791e9f38
commit 550b52abf6
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
158 changed files with 6018 additions and 3499 deletions

View file

@ -22,30 +22,31 @@
#include "libc/testlib/testlib.h"
#include "libc/x/xasprintf.h"
double _tan(double) asm("tan");
float _tanf(float) asm("tanf");
long double _tanl(long double) asm("tanl");
TEST(tan, test) {
EXPECT_STREQ("0", _gc(xasprintf("%.15g", tan(0.))));
EXPECT_STREQ("-0", _gc(xasprintf("%.15g", tan(-0.))));
EXPECT_STREQ("0.54630248984379", _gc(xasprintf("%.15g", tan(.5))));
EXPECT_STREQ("-0.54630248984379", _gc(xasprintf("%.15g", tan(-.5))));
EXPECT_STREQ("1.5574077246549", _gc(xasprintf("%.15g", tan(1.))));
EXPECT_STREQ("-1.5574077246549", _gc(xasprintf("%.15g", tan(-1.))));
EXPECT_STREQ("14.1014199471717", _gc(xasprintf("%.15g", tan(1.5))));
EXPECT_STREQ("-14.1014199471717", _gc(xasprintf("%.15g", tan(-1.5))));
EXPECT_STREQ("nan", _gc(xasprintf("%.15g", tan(NAN))));
EXPECT_STREQ("-nan", _gc(xasprintf("%.15g", tan(-NAN))));
EXPECT_STREQ("-nan", _gc(xasprintf("%.15g", tan(INFINITY))));
EXPECT_STREQ("-nan", _gc(xasprintf("%.15g", tan(-INFINITY))));
EXPECT_STREQ("0", _gc(xasprintf("%.15g", _tan(0.))));
EXPECT_STREQ("-0", _gc(xasprintf("%.15g", _tan(-0.))));
EXPECT_STREQ("0.54630248984379", _gc(xasprintf("%.15g", _tan(.5))));
EXPECT_STREQ("-0.54630248984379", _gc(xasprintf("%.15g", _tan(-.5))));
EXPECT_STREQ("1.5574077246549", _gc(xasprintf("%.15g", _tan(1.))));
EXPECT_STREQ("-1.5574077246549", _gc(xasprintf("%.15g", _tan(-1.))));
EXPECT_STREQ("14.1014199471717", _gc(xasprintf("%.15g", _tan(1.5))));
EXPECT_STREQ("-14.1014199471717", _gc(xasprintf("%.15g", _tan(-1.5))));
EXPECT_STREQ("nan", _gc(xasprintf("%.15g", _tan(NAN))));
EXPECT_STREQ("-nan", _gc(xasprintf("%.15g", _tan(-NAN))));
EXPECT_TRUE(isnan(_tan(INFINITY)));
EXPECT_TRUE(isnan(_tan(-INFINITY)));
EXPECT_STREQ("2.2250738585072e-308",
_gc(xasprintf("%.15g", tan(__DBL_MIN__))));
_gc(xasprintf("%.15g", _tan(__DBL_MIN__))));
EXPECT_STREQ("-0.0049620158744449",
_gc(xasprintf("%.15g", tan(__DBL_MAX__))));
_gc(xasprintf("%.15g", _tan(__DBL_MAX__))));
}
BENCH(tan, bench) {
double _tan(double) asm("tan");
float _tanf(float) asm("tanf");
long double _tanl(long double) asm("tanl");
EZBENCH2("tan", donothing, _tan(.7)); /* ~19ns */
EZBENCH2("tanf", donothing, _tanf(.7)); /* ~32ns */
EZBENCH2("tanl", donothing, _tanl(.7)); /* ~28ns */
EZBENCH2("tan", donothing, _tan(.7)); // ~18ns
EZBENCH2("tanf", donothing, _tanf(.7)); // ~6ns
EZBENCH2("tanl", donothing, _tanl(.7)); // ~39ns
}