Make further progress on non-x86 support

This commit is contained in:
Justine Tunney 2023-05-08 21:38:30 -07:00
parent aef9a69a60
commit 036b9a0002
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
155 changed files with 2307 additions and 653 deletions

View file

@ -205,11 +205,20 @@ static inline u128 mul128_tail(u128 a, u128 b)
return lo;
}
/* see sqrt.c for detailed comments. */
/**
* Returns square root of 𝑥.
*/
long double sqrtl(long double x)
{
#ifdef __x86__
asm("fsqrt" : "+t"(x));
return x;
#else
u128 ix, ml;
uint64_t top;
@ -285,7 +294,10 @@ long double sqrtl(long double x)
y += mkldbl(top, (u128){0});
}
return y;
#endif /* __x86__ */
}
#else
#error unsupported long double format
#endif