mirror of
git://git.musl-libc.org/musl
synced 2025-02-15 18:36:54 +00:00
math: move x87-family rint functions to C with inline asm
This commit is contained in:
parent
9443f1b5cf
commit
51f4f8c512
7
src/math/i386/rint.c
Normal file
7
src/math/i386/rint.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
double rint(double x)
|
||||||
|
{
|
||||||
|
__asm__ ("frndint" : "+t"(x));
|
||||||
|
return x;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
.global rint
|
|
||||||
.type rint,@function
|
|
||||||
rint:
|
|
||||||
fldl 4(%esp)
|
|
||||||
frndint
|
|
||||||
ret
|
|
7
src/math/i386/rintf.c
Normal file
7
src/math/i386/rintf.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
float rintf(float x)
|
||||||
|
{
|
||||||
|
__asm__ ("frndint" : "+t"(x));
|
||||||
|
return x;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
.global rintf
|
|
||||||
.type rintf,@function
|
|
||||||
rintf:
|
|
||||||
flds 4(%esp)
|
|
||||||
frndint
|
|
||||||
ret
|
|
7
src/math/i386/rintl.c
Normal file
7
src/math/i386/rintl.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long double rintl(long double x)
|
||||||
|
{
|
||||||
|
__asm__ ("frndint" : "+t"(x));
|
||||||
|
return x;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
.global rintl
|
|
||||||
.type rintl,@function
|
|
||||||
rintl:
|
|
||||||
fldt 4(%esp)
|
|
||||||
frndint
|
|
||||||
ret
|
|
7
src/math/x86_64/rintl.c
Normal file
7
src/math/x86_64/rintl.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
long double rintl(long double x)
|
||||||
|
{
|
||||||
|
__asm__ ("frndint" : "+t"(x));
|
||||||
|
return x;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
.global rintl
|
|
||||||
.type rintl,@function
|
|
||||||
rintl:
|
|
||||||
fldt 8(%rsp)
|
|
||||||
frndint
|
|
||||||
ret
|
|
Loading…
Reference in New Issue
Block a user