Browse Source

math: move x87-family rint functions to C with inline asm

master
Alexander Monakov 6 years ago
committed by Rich Felker
parent
commit
51f4f8c512
  1. 7
      src/math/i386/rint.c
  2. 6
      src/math/i386/rint.s
  3. 7
      src/math/i386/rintf.c
  4. 6
      src/math/i386/rintf.s
  5. 7
      src/math/i386/rintl.c
  6. 6
      src/math/i386/rintl.s
  7. 7
      src/math/x86_64/rintl.c
  8. 6
      src/math/x86_64/rintl.s

7
src/math/i386/rint.c

@ -0,0 +1,7 @@
#include <math.h>
double rint(double x)
{
__asm__ ("frndint" : "+t"(x));
return x;
}

6
src/math/i386/rint.s

@ -1,6 +0,0 @@
.global rint
.type rint,@function
rint:
fldl 4(%esp)
frndint
ret

7
src/math/i386/rintf.c

@ -0,0 +1,7 @@
#include <math.h>
float rintf(float x)
{
__asm__ ("frndint" : "+t"(x));
return x;
}

6
src/math/i386/rintf.s

@ -1,6 +0,0 @@
.global rintf
.type rintf,@function
rintf:
flds 4(%esp)
frndint
ret

7
src/math/i386/rintl.c

@ -0,0 +1,7 @@
#include <math.h>
long double rintl(long double x)
{
__asm__ ("frndint" : "+t"(x));
return x;
}

6
src/math/i386/rintl.s

@ -1,6 +0,0 @@
.global rintl
.type rintl,@function
rintl:
fldt 4(%esp)
frndint
ret

7
src/math/x86_64/rintl.c

@ -0,0 +1,7 @@
#include <math.h>
long double rintl(long double x)
{
__asm__ ("frndint" : "+t"(x));
return x;
}

6
src/math/x86_64/rintl.s

@ -1,6 +0,0 @@
.global rintl
.type rintl,@function
rintl:
fldt 8(%rsp)
frndint
ret
Loading…
Cancel
Save