Get LIBC_TESTLIB building on AARCH64

This commit is contained in:
Justine Tunney 2023-05-11 19:56:33 -07:00
parent 95fab334e4
commit 5e2f7f7ced
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
46 changed files with 975 additions and 1174 deletions

View file

@ -23,48 +23,48 @@
#include "libc/x/x.h"
#include "libc/x/xasprintf.h"
#define atanhl(x) atanhl(VEIL("t", (long double)(x)))
#define atanh(x) atanh(VEIL("x", (double)(x)))
#define atanhf(x) atanhf(VEIL("x", (float)(x)))
double _atanh(double) asm("atanh");
float _atanhf(float) asm("atanhf");
long double _atanhl(long double) asm("atanhl");
TEST(atanh, test) {
EXPECT_STREQ("0", _gc(xdtoa(atanh(0))));
EXPECT_STREQ("-0", _gc(xdtoa(atanh(-0.))));
EXPECT_STREQ(".549306144334055", _gc(xdtoa(atanh(.5))));
EXPECT_STREQ("-.549306144334055", _gc(xdtoa(atanh(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoa(atanh(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoa(atanh(-1))));
EXPECT_TRUE(isnan(atanh(+1.1)));
EXPECT_TRUE(isnan(atanh(-1.1)));
EXPECT_STREQ("0", _gc(xdtoa(_atanh(0))));
EXPECT_STREQ("-0", _gc(xdtoa(_atanh(-0.))));
EXPECT_STREQ(".549306144334055", _gc(xdtoa(_atanh(.5))));
EXPECT_STREQ("-.549306144334055", _gc(xdtoa(_atanh(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoa(_atanh(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoa(_atanh(-1))));
EXPECT_TRUE(isnan(_atanh(+1.1)));
EXPECT_TRUE(isnan(_atanh(-1.1)));
EXPECT_STREQ("-2.1073424255447e-08",
_gc(xasprintf("%.15g", atanh(-2.1073424255447e-08))));
_gc(xasprintf("%.15g", _atanh(-2.1073424255447e-08))));
}
TEST(atanhl, test) {
EXPECT_STREQ("0", _gc(xdtoal(atanhl(0))));
EXPECT_STREQ("-0", _gc(xdtoal(atanhl(-0.))));
EXPECT_STREQ(".5493061443340548", _gc(xdtoal(atanhl(.5))));
EXPECT_STREQ("-.5493061443340548", _gc(xdtoal(atanhl(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoal(atanhl(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoal(atanhl(-1))));
EXPECT_TRUE(isnan(atanhl(+1.1)));
EXPECT_TRUE(isnan(atanhl(-1.1)));
EXPECT_STREQ("0", _gc(xdtoal(_atanhl(0))));
EXPECT_STREQ("-0", _gc(xdtoal(_atanhl(-0.))));
EXPECT_STREQ(".5493061443340548", _gc(xdtoal(_atanhl(.5))));
EXPECT_STREQ("-.5493061443340548", _gc(xdtoal(_atanhl(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoal(_atanhl(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoal(_atanhl(-1))));
EXPECT_TRUE(isnan(_atanhl(+1.1)));
EXPECT_TRUE(isnan(_atanhl(-1.1)));
}
TEST(atanhf, test) {
EXPECT_STREQ("0", _gc(xdtoaf(atanhf(0))));
EXPECT_STREQ("-0", _gc(xdtoaf(atanhf(-0.))));
EXPECT_STREQ(".549306", _gc(xdtoaf(atanhf(.5))));
EXPECT_STREQ("-.549306", _gc(xdtoaf(atanhf(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoaf(atanhf(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoaf(atanhf(-1))));
EXPECT_TRUE(isnan(atanhf(+1.1)));
EXPECT_TRUE(isnan(atanhf(-1.1)));
EXPECT_STREQ("0", _gc(xdtoaf(_atanhf(0))));
EXPECT_STREQ("-0", _gc(xdtoaf(_atanhf(-0.))));
EXPECT_STREQ(".549306", _gc(xdtoaf(_atanhf(.5))));
EXPECT_STREQ("-.549306", _gc(xdtoaf(_atanhf(-.5))));
EXPECT_STREQ("INFINITY", _gc(xdtoaf(_atanhf(+1))));
EXPECT_STREQ("-INFINITY", _gc(xdtoaf(_atanhf(-1))));
EXPECT_TRUE(isnan(_atanhf(+1.1)));
EXPECT_TRUE(isnan(_atanhf(-1.1)));
}
BENCH(atanh, bench) {
BENCH(_atanh, bench) {
volatile double a = .5;
EZBENCH2("atanhf", donothing, EXPROPRIATE(atanhf(a)));
EZBENCH2("atanh", donothing, EXPROPRIATE(atanh(a)));
EZBENCH2("atanhl", donothing, EXPROPRIATE(atanhl(a)));
EZBENCH2("atanhf", donothing, EXPROPRIATE(_atanhf(a)));
EZBENCH2("atanh", donothing, EXPROPRIATE(_atanh(a)));
EZBENCH2("atanhl", donothing, EXPROPRIATE(_atanhl(a)));
}