diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2020-01-15 18:42:46 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-03-24 16:31:36 -0400 |
commit | bc87299ce72a52f4debf9fc19d859abe34dbdf43 (patch) | |
tree | 95763fe2cf648fe78c7cf2ce273d86b589050152 /src/math/x86_64/fmodl.c | |
parent | b173e4262f65800ea488b4494125284779a61547 (diff) | |
download | musl-bc87299ce72a52f4debf9fc19d859abe34dbdf43.tar.gz musl-bc87299ce72a52f4debf9fc19d859abe34dbdf43.tar.bz2 musl-bc87299ce72a52f4debf9fc19d859abe34dbdf43.tar.xz musl-bc87299ce72a52f4debf9fc19d859abe34dbdf43.zip |
math: move x87-family fmod functions to C with inline asm
Diffstat (limited to 'src/math/x86_64/fmodl.c')
-rw-r--r-- | src/math/x86_64/fmodl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/math/x86_64/fmodl.c b/src/math/x86_64/fmodl.c new file mode 100644 index 00000000..3daeab06 --- /dev/null +++ b/src/math/x86_64/fmodl.c @@ -0,0 +1,9 @@ +#include <math.h> + +long double fmodl(long double x, long double y) +{ + unsigned short fpsr; + do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); + while (fpsr & 0x400); + return x; +} |