asm for modf functions
authorRich Felker <dalias@aerifal.cx>
Mon, 19 Mar 2012 09:56:41 +0000 (05:56 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 19 Mar 2012 09:56:41 +0000 (05:56 -0400)
src/math/i386/modf.s [new file with mode: 0644]
src/math/i386/modff.s [new file with mode: 0644]
src/math/i386/modfl.s [new file with mode: 0644]

diff --git a/src/math/i386/modf.s b/src/math/i386/modf.s
new file mode 100644 (file)
index 0000000..b88e784
--- /dev/null
@@ -0,0 +1,15 @@
+.global modf
+.type modf,@function
+modf:
+       mov 12(%esp),%eax
+       fldl 4(%esp)
+       fld1
+       fld %st(1)
+1:     fprem
+       fstsw %ax
+       sahf
+       jp 1b
+       fstp %st(1)
+       fsubr %st(1)
+       fstpl (%eax)
+       ret
diff --git a/src/math/i386/modff.s b/src/math/i386/modff.s
new file mode 100644 (file)
index 0000000..d29b4b6
--- /dev/null
@@ -0,0 +1,15 @@
+.global modff
+.type modff,@function
+modff:
+       mov 8(%esp),%eax
+       flds 4(%esp)
+       fld1
+       fld %st(1)
+1:     fprem
+       fstsw %ax
+       sahf
+       jp 1b
+       fstp %st(1)
+       fsubr %st(1)
+       fstps (%eax)
+       ret
diff --git a/src/math/i386/modfl.s b/src/math/i386/modfl.s
new file mode 100644 (file)
index 0000000..f938008
--- /dev/null
@@ -0,0 +1,15 @@
+.global modfl
+.type modfl,@function
+modfl:
+       mov 16(%esp),%eax
+       fldt 4(%esp)
+       fld1
+       fld %st(1)
+1:     fprem
+       fstsw %ax
+       sahf
+       jp 1b
+       fstp %st(1)
+       fsubr %st(1)
+       fstpt (%eax)
+       ret