summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-19 09:42:51 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-19 09:42:51 -0400
commit27deb538896b5c3b8ceca206ec505ff834c97300 (patch)
tree9f7a69b5997510e68cffffb6bbfd093dab56871f
parent02db27d9deaee71b244c91e720ec819c74dab150 (diff)
downloadmusl-27deb538896b5c3b8ceca206ec505ff834c97300.tar.gz
musl-27deb538896b5c3b8ceca206ec505ff834c97300.tar.bz2
musl-27deb538896b5c3b8ceca206ec505ff834c97300.tar.xz
musl-27deb538896b5c3b8ceca206ec505ff834c97300.zip
asm for remquo
this could perhaps use some additional testing for corner cases, but it seems to be correct.
-rw-r--r--src/math/i386/remquo.s41
-rw-r--r--src/math/i386/remquof.s1
-rw-r--r--src/math/i386/remquol.s1
3 files changed, 43 insertions, 0 deletions
diff --git a/src/math/i386/remquo.s b/src/math/i386/remquo.s
new file mode 100644
index 00000000..86ae2dc3
--- /dev/null
+++ b/src/math/i386/remquo.s
@@ -0,0 +1,41 @@
+.global remquof
+.type remquof,@function
+remquof:
+ mov 12(%esp),%ecx
+ fldl 4(%esp)
+ fldl 8(%esp)
+ jmp 1f
+
+.global remquol
+.type remquol,@function
+remquol:
+ mov 28(%esp),%ecx
+ fldl 4(%esp)
+ fldl 16(%esp)
+ jmp 1f
+
+.global remquo
+.type remquo,@function
+remquo:
+ mov 20(%esp),%ecx
+ fldl 4(%esp)
+ fldl 12(%esp)
+1: fld %st(1)
+1: fprem1
+ fnstsw %ax
+ sahf
+ jp 1b
+ fsubr %st(0),%st(2)
+ fxch %st(2)
+ fdivp
+ mov $0x4f000000,%eax
+ mov %eax,4(%esp)
+ flds 4(%esp)
+ fxch %st(1)
+1: fprem
+ fnstsw %ax
+ sahf
+ jp 1b
+ fistpl (%ecx)
+ fstp %st(0)
+ ret
diff --git a/src/math/i386/remquof.s b/src/math/i386/remquof.s
new file mode 100644
index 00000000..511a6bc7
--- /dev/null
+++ b/src/math/i386/remquof.s
@@ -0,0 +1 @@
+# see remquo.s
diff --git a/src/math/i386/remquol.s b/src/math/i386/remquol.s
new file mode 100644
index 00000000..511a6bc7
--- /dev/null
+++ b/src/math/i386/remquol.s
@@ -0,0 +1 @@
+# see remquo.s