mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
math: move x87-family fabs functions to C with inline asm
This commit is contained in:
parent
87026f6843
commit
c24a992386
8 changed files with 28 additions and 24 deletions
7
src/math/i386/fabs.c
Normal file
7
src/math/i386/fabs.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <math.h>
|
||||
|
||||
double fabs(double x)
|
||||
{
|
||||
__asm__ ("fabs" : "+t"(x));
|
||||
return x;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
.global fabs
|
||||
.type fabs,@function
|
||||
fabs:
|
||||
fldl 4(%esp)
|
||||
fabs
|
||||
ret
|
7
src/math/i386/fabsf.c
Normal file
7
src/math/i386/fabsf.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <math.h>
|
||||
|
||||
float fabsf(float x)
|
||||
{
|
||||
__asm__ ("fabs" : "+t"(x));
|
||||
return x;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
.global fabsf
|
||||
.type fabsf,@function
|
||||
fabsf:
|
||||
flds 4(%esp)
|
||||
fabs
|
||||
ret
|
7
src/math/i386/fabsl.c
Normal file
7
src/math/i386/fabsl.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <math.h>
|
||||
|
||||
long double fabsl(long double x)
|
||||
{
|
||||
__asm__ ("fabs" : "+t"(x));
|
||||
return x;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
.global fabsl
|
||||
.type fabsl,@function
|
||||
fabsl:
|
||||
fldt 4(%esp)
|
||||
fabs
|
||||
ret
|
7
src/math/x86_64/fabsl.c
Normal file
7
src/math/x86_64/fabsl.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <math.h>
|
||||
|
||||
long double fabsl(long double x)
|
||||
{
|
||||
__asm__ ("fabs" : "+t"(x));
|
||||
return x;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
.global fabsl
|
||||
.type fabsl,@function
|
||||
fabsl:
|
||||
fldt 8(%rsp)
|
||||
fabs
|
||||
ret
|
Loading…
Add table
Reference in a new issue