mirror of
git://git.musl-libc.org/musl
synced 2025-02-15 18:36:54 +00:00
math: move i386 sqrtf to C with inline asm
This commit is contained in:
parent
41b290ba39
commit
29adaeb2c0
12
src/math/i386/sqrtf.c
Normal file
12
src/math/i386/sqrtf.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
float sqrtf(float x)
|
||||||
|
{
|
||||||
|
long double t;
|
||||||
|
/* The long double result has sufficient precision so that
|
||||||
|
* second rounding to float still keeps the returned value
|
||||||
|
* correctly rounded, see Pierre Roux, "Innocuous Double
|
||||||
|
* Rounding of Basic Arithmetic Operations". */
|
||||||
|
__asm__ ("fsqrt" : "=t"(t) : "0"(x));
|
||||||
|
return (float)t;
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
.global sqrtf
|
|
||||||
.type sqrtf,@function
|
|
||||||
sqrtf: flds 4(%esp)
|
|
||||||
fsqrt
|
|
||||||
fstps 4(%esp)
|
|
||||||
flds 4(%esp)
|
|
||||||
ret
|
|
Loading…
Reference in New Issue
Block a user