summaryrefslogtreecommitdiff
path: root/src/math/x86_64/lrintf.c
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2020-01-10 23:06:36 +0300
committerRich Felker <dalias@aerifal.cx>2020-03-24 16:31:36 -0400
commit6bbdbfdcdeac216c4a13edd04dee1f6d87bd33c8 (patch)
tree84636c660b5f360ed5545824ebf4d747bed8e60f /src/math/x86_64/lrintf.c
parentacfe6d033eafe12d61ad91f496850b1bf58c6f98 (diff)
downloadmusl-6bbdbfdcdeac216c4a13edd04dee1f6d87bd33c8.tar.gz
math: move x86_64 (l)lrint(f) functions to C with inline asm
Diffstat (limited to 'src/math/x86_64/lrintf.c')
-rw-r--r--src/math/x86_64/lrintf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/x86_64/lrintf.c b/src/math/x86_64/lrintf.c
new file mode 100644
index 00000000..2ba5639d
--- /dev/null
+++ b/src/math/x86_64/lrintf.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+long lrintf(float x)
+{
+ long r;
+ __asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
+ return r;
+}