assembly optimizations for fmod/remainder functions

This commit is contained in:
Rich Felker 2012-03-18 17:09:34 -04:00
commit b935147761
8 changed files with 88 additions and 0 deletions

11
src/math/i386/fmod.s Normal file
View file

@ -0,0 +1,11 @@
.global fmod
.type fmod,@function
fmod:
fldl 12(%esp)
fldl 4(%esp)
1: fprem
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

11
src/math/i386/fmodf.s Normal file
View file

@ -0,0 +1,11 @@
.global fmodf
.type fmodf,@function
fmodf:
flds 8(%esp)
flds 4(%esp)
1: fprem
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

11
src/math/i386/fmodl.s Normal file
View file

@ -0,0 +1,11 @@
.global fmodl
.type fmodl,@function
fmodl:
fldt 16(%esp)
fldt 4(%esp)
1: fprem
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

11
src/math/i386/remainder.s Normal file
View file

@ -0,0 +1,11 @@
.global remainder
.type remainder,@function
remainder:
fldl 12(%esp)
fldl 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

View file

@ -0,0 +1,11 @@
.global remainderf
.type remainderf,@function
remainderf:
flds 8(%esp)
flds 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

View file

@ -0,0 +1,11 @@
.global remainderl
.type remainderl,@function
remainderl:
fldt 16(%esp)
fldt 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

11
src/math/x86_64/fmodl.s Normal file
View file

@ -0,0 +1,11 @@
.global fmodl
.type fmodl,@function
fmodl:
fldt 24(%rsp)
fldt 8(%rsp)
1: fprem
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret

View file

@ -0,0 +1,11 @@
.global remainderl
.type remainderl,@function
remainderl:
fldt 24(%rsp)
fldt 8(%rsp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret