asm versions of some simple math functions for i386 and x86_64

these are functions that have direct fpu approaches to implementation
without problematic exception or rounding issues. x86_64 lacks
float/double versions because i'm unfamiliar with the necessary sse
code for performing these operations.
This commit is contained in:
Rich Felker 2012-03-18 16:43:54 -04:00
parent afad262440
commit 8d9e948652
8 changed files with 48 additions and 0 deletions

6
src/math/i386/fabs.s Normal file
View File

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

6
src/math/i386/fabsf.s Normal file
View File

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

6
src/math/i386/fabsl.s Normal file
View File

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

6
src/math/i386/rint.s Normal file
View File

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

6
src/math/i386/rintf.s Normal file
View File

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

6
src/math/i386/rintl.s Normal file
View File

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

6
src/math/x86_64/fabsl.s Normal file
View File

@ -0,0 +1,6 @@
.global fabsl
.type fabsl,@function
fabsl:
fldt 8(%rsp)
fabs
ret

6
src/math/x86_64/rintl.s Normal file
View File

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