summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-03-23 11:16:56 +0100
committernsz <nsz@port70.net>2012-03-23 11:16:56 +0100
commitc5ec5b2ce93bd87eb3dbf966d8bf279089f8a35d (patch)
tree35a276d479538eb3898e47358e9e8eded63cf5cc /src/math
parent6d8df2b9720b7133a0735c9d5a2aae55021bb2c2 (diff)
parentad2d2b963a4bf9e2631b345c898e8715b36b459e (diff)
downloadmusl-c5ec5b2ce93bd87eb3dbf966d8bf279089f8a35d.tar.gz
Merge branch 'master' of git://git.etalabs.net/musl
Diffstat (limited to 'src/math')
-rw-r--r--src/math/i386/hypot.s45
-rw-r--r--src/math/i386/hypotf.s42
2 files changed, 87 insertions, 0 deletions
diff --git a/src/math/i386/hypot.s b/src/math/i386/hypot.s
new file mode 100644
index 00000000..299c2e18
--- /dev/null
+++ b/src/math/i386/hypot.s
@@ -0,0 +1,45 @@
+.global hypot
+.type hypot,@function
+hypot:
+ mov 8(%esp),%eax
+ mov 16(%esp),%ecx
+ add %eax,%eax
+ add %ecx,%ecx
+ and %eax,%ecx
+ cmp $0xffe00000,%ecx
+ jae 2f
+ or 4(%esp),%eax
+ jnz 1f
+ fldl 12(%esp)
+ fabs
+ ret
+1: mov 16(%esp),%eax
+ add %eax,%eax
+ or 12(%esp),%eax
+ jnz 1f
+ fldl 4(%esp)
+ fabs
+ ret
+1: fldl 4(%esp)
+ fld %st(0)
+ fmulp
+ fldl 12(%esp)
+ fld %st(0)
+ fmulp
+ faddp
+ fsqrt
+ ret
+2: sub $0xffe00000,%eax
+ or 4(%esp),%eax
+ jnz 1f
+ fldl 4(%esp)
+ fabs
+ ret
+1: mov 16(%esp),%eax
+ add %eax,%eax
+ sub $0xffe00000,%eax
+ or 12(%esp),%eax
+ fldl 12(%esp)
+ jnz 1f
+ fabs
+1: ret
diff --git a/src/math/i386/hypotf.s b/src/math/i386/hypotf.s
new file mode 100644
index 00000000..068935e2
--- /dev/null
+++ b/src/math/i386/hypotf.s
@@ -0,0 +1,42 @@
+.global hypotf
+.type hypotf,@function
+hypotf:
+ mov 4(%esp),%eax
+ mov 8(%esp),%ecx
+ add %eax,%eax
+ add %ecx,%ecx
+ and %eax,%ecx
+ cmp $0xff000000,%ecx
+ jae 2f
+ test %eax,%eax
+ jnz 1f
+ flds 8(%esp)
+ fabs
+ ret
+1: mov 8(%esp),%eax
+ add %eax,%eax
+ jnz 1f
+ flds 4(%esp)
+ fabs
+ ret
+1: flds 4(%esp)
+ fld %st(0)
+ fmulp
+ flds 8(%esp)
+ fld %st(0)
+ fmulp
+ faddp
+ fsqrt
+ ret
+2: cmp $0xff000000,%eax
+ jnz 1f
+ flds 4(%esp)
+ fabs
+ ret
+1: mov 8(%esp),%eax
+ add %eax,%eax
+ cmp $0xff000000,%eax
+ flds 8(%esp)
+ jnz 1f
+ fabs
+1: ret