diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2020-01-14 14:53:38 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-03-24 16:31:36 -0400 |
commit | 51f4f8c512d682fe0c1a7a891909e75f416f20f6 (patch) | |
tree | 1d2d597d39a9604273a1d695f4ab7620f7e441a8 | |
parent | 9443f1b5cfeba687f45b96572378519e81ff9a56 (diff) | |
download | musl-51f4f8c512d682fe0c1a7a891909e75f416f20f6.tar.gz musl-51f4f8c512d682fe0c1a7a891909e75f416f20f6.tar.bz2 musl-51f4f8c512d682fe0c1a7a891909e75f416f20f6.tar.xz musl-51f4f8c512d682fe0c1a7a891909e75f416f20f6.zip |
math: move x87-family rint functions to C with inline asm
-rw-r--r-- | src/math/i386/rint.c | 7 | ||||
-rw-r--r-- | src/math/i386/rint.s | 6 | ||||
-rw-r--r-- | src/math/i386/rintf.c | 7 | ||||
-rw-r--r-- | src/math/i386/rintf.s | 6 | ||||
-rw-r--r-- | src/math/i386/rintl.c | 7 | ||||
-rw-r--r-- | src/math/i386/rintl.s | 6 | ||||
-rw-r--r-- | src/math/x86_64/rintl.c | 7 | ||||
-rw-r--r-- | src/math/x86_64/rintl.s | 6 |
8 files changed, 28 insertions, 24 deletions
diff --git a/src/math/i386/rint.c b/src/math/i386/rint.c new file mode 100644 index 00000000..a5276a60 --- /dev/null +++ b/src/math/i386/rint.c @@ -0,0 +1,7 @@ +#include <math.h> + +double rint(double x) +{ + __asm__ ("frndint" : "+t"(x)); + return x; +} diff --git a/src/math/i386/rint.s b/src/math/i386/rint.s deleted file mode 100644 index bb99a11c..00000000 --- a/src/math/i386/rint.s +++ /dev/null @@ -1,6 +0,0 @@ -.global rint -.type rint,@function -rint: - fldl 4(%esp) - frndint - ret diff --git a/src/math/i386/rintf.c b/src/math/i386/rintf.c new file mode 100644 index 00000000..bb4121a4 --- /dev/null +++ b/src/math/i386/rintf.c @@ -0,0 +1,7 @@ +#include <math.h> + +float rintf(float x) +{ + __asm__ ("frndint" : "+t"(x)); + return x; +} diff --git a/src/math/i386/rintf.s b/src/math/i386/rintf.s deleted file mode 100644 index bce4c5a6..00000000 --- a/src/math/i386/rintf.s +++ /dev/null @@ -1,6 +0,0 @@ -.global rintf -.type rintf,@function -rintf: - flds 4(%esp) - frndint - ret diff --git a/src/math/i386/rintl.c b/src/math/i386/rintl.c new file mode 100644 index 00000000..e1a92077 --- /dev/null +++ b/src/math/i386/rintl.c @@ -0,0 +1,7 @@ +#include <math.h> + +long double rintl(long double x) +{ + __asm__ ("frndint" : "+t"(x)); + return x; +} diff --git a/src/math/i386/rintl.s b/src/math/i386/rintl.s deleted file mode 100644 index cd2bf9a9..00000000 --- a/src/math/i386/rintl.s +++ /dev/null @@ -1,6 +0,0 @@ -.global rintl -.type rintl,@function -rintl: - fldt 4(%esp) - frndint - ret diff --git a/src/math/x86_64/rintl.c b/src/math/x86_64/rintl.c new file mode 100644 index 00000000..e1a92077 --- /dev/null +++ b/src/math/x86_64/rintl.c @@ -0,0 +1,7 @@ +#include <math.h> + +long double rintl(long double x) +{ + __asm__ ("frndint" : "+t"(x)); + return x; +} diff --git a/src/math/x86_64/rintl.s b/src/math/x86_64/rintl.s deleted file mode 100644 index 64e663cd..00000000 --- a/src/math/x86_64/rintl.s +++ /dev/null @@ -1,6 +0,0 @@ -.global rintl -.type rintl,@function -rintl: - fldt 8(%rsp) - frndint - ret |