mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
math: move x86_64 (l)lrint(f) functions to C with inline asm
This commit is contained in:
parent
acfe6d033e
commit
6bbdbfdcde
8 changed files with 32 additions and 20 deletions
8
src/math/x86_64/llrint.c
Normal file
8
src/math/x86_64/llrint.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long long llrint(double x)
|
||||||
|
{
|
||||||
|
long long r;
|
||||||
|
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
|
||||||
|
return r;
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
.global llrint
|
|
||||||
.type llrint,@function
|
|
||||||
llrint:
|
|
||||||
cvtsd2si %xmm0,%rax
|
|
||||||
ret
|
|
8
src/math/x86_64/llrintf.c
Normal file
8
src/math/x86_64/llrintf.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long long llrintf(float x)
|
||||||
|
{
|
||||||
|
long long r;
|
||||||
|
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
|
||||||
|
return r;
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
.global llrintf
|
|
||||||
.type llrintf,@function
|
|
||||||
llrintf:
|
|
||||||
cvtss2si %xmm0,%rax
|
|
||||||
ret
|
|
8
src/math/x86_64/lrint.c
Normal file
8
src/math/x86_64/lrint.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long lrint(double x)
|
||||||
|
{
|
||||||
|
long r;
|
||||||
|
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
|
||||||
|
return r;
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
.global lrint
|
|
||||||
.type lrint,@function
|
|
||||||
lrint:
|
|
||||||
cvtsd2si %xmm0,%rax
|
|
||||||
ret
|
|
8
src/math/x86_64/lrintf.c
Normal file
8
src/math/x86_64/lrintf.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long lrintf(float x)
|
||||||
|
{
|
||||||
|
long r;
|
||||||
|
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
|
||||||
|
return r;
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
.global lrintf
|
|
||||||
.type lrintf,@function
|
|
||||||
lrintf:
|
|
||||||
cvtss2si %xmm0,%rax
|
|
||||||
ret
|
|
Loading…
Add table
Reference in a new issue