summaryrefslogtreecommitdiff
path: root/src/math/i386/lrint.c
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2020-01-11 18:14:24 +0300
committerRich Felker <dalias@aerifal.cx>2020-03-24 16:31:36 -0400
commit9443f1b5cfeba687f45b96572378519e81ff9a56 (patch)
tree1bcb10b7cb7fc99c21cccd556dae541cc04214ff /src/math/i386/lrint.c
parent6bbdbfdcdeac216c4a13edd04dee1f6d87bd33c8 (diff)
downloadmusl-9443f1b5cfeba687f45b96572378519e81ff9a56.tar.gz
math: move x87-family lrint functions to C with inline asm
Diffstat (limited to 'src/math/i386/lrint.c')
-rw-r--r--src/math/i386/lrint.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/i386/lrint.c b/src/math/i386/lrint.c
new file mode 100644
index 00000000..89563ab2
--- /dev/null
+++ b/src/math/i386/lrint.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+long lrint(double x)
+{
+ long r;
+ __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st");
+ return r;
+}