summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-19 04:56:07 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-19 04:56:07 -0400
commitbc33e617040166e971ec1e6822ac1cc417eb6c9c (patch)
tree984dfc67487f0759fa5cceca0e9e53e28ad05b99
parent495a52ae7bb581aac2942d7cb095cca2ff53ca3c (diff)
downloadmusl-bc33e617040166e971ec1e6822ac1cc417eb6c9c.tar.gz
asm for inverse trig functions
unlike trig functions, these are easy to do in asm because they do not involve (arbitrary-precision) argument reduction. fpatan automatically takes care of domain issues, and in asin and acos, fsqrt takes care of them for us.
-rw-r--r--src/math/i386/acos.s24
-rw-r--r--src/math/i386/acosf.s1
-rw-r--r--src/math/i386/acosl.s1
-rw-r--r--src/math/i386/asin.s23
-rw-r--r--src/math/i386/asinf.s1
-rw-r--r--src/math/i386/asinl.s1
-rw-r--r--src/math/i386/atan.s7
-rw-r--r--src/math/i386/atan2.s7
-rw-r--r--src/math/i386/atan2f.s7
-rw-r--r--src/math/i386/atan2l.s7
-rw-r--r--src/math/i386/atanf.s7
-rw-r--r--src/math/i386/atanl.s7
12 files changed, 93 insertions, 0 deletions
diff --git a/src/math/i386/acos.s b/src/math/i386/acos.s
new file mode 100644
index 00000000..6f9ef7f0
--- /dev/null
+++ b/src/math/i386/acos.s
@@ -0,0 +1,24 @@
+.global acosf
+.type acosf,@function
+acosf:
+ flds 4(%esp)
+ jmp 1f
+
+.global acosl
+.type acosl,@function
+acosl:
+ fldt 4(%esp)
+ jmp 1f
+
+.global acos
+.type acos,@function
+acos:
+ fldl 4(%esp)
+1: fld %st(0)
+ fmul %st(0)
+ fld1
+ fsubp %st(1)
+ fsqrt
+ fxch %st(1)
+ fpatan
+ ret
diff --git a/src/math/i386/acosf.s b/src/math/i386/acosf.s
new file mode 100644
index 00000000..6c95509f
--- /dev/null
+++ b/src/math/i386/acosf.s
@@ -0,0 +1 @@
+# see acos.s
diff --git a/src/math/i386/acosl.s b/src/math/i386/acosl.s
new file mode 100644
index 00000000..6c95509f
--- /dev/null
+++ b/src/math/i386/acosl.s
@@ -0,0 +1 @@
+# see acos.s
diff --git a/src/math/i386/asin.s b/src/math/i386/asin.s
new file mode 100644
index 00000000..cab7bfc8
--- /dev/null
+++ b/src/math/i386/asin.s
@@ -0,0 +1,23 @@
+.global asinf
+.type asinf,@function
+asinf:
+ flds 4(%esp)
+ jmp 1f
+
+.global asinl
+.type asinl,@function
+asinl:
+ fldt 4(%esp)
+ jmp 1f
+
+.global asin
+.type asin,@function
+asin:
+ fldl 4(%esp)
+1: fld %st(0)
+ fmul %st(0)
+ fld1
+ fsubp %st(1)
+ fsqrt
+ fpatan
+ ret
diff --git a/src/math/i386/asinf.s b/src/math/i386/asinf.s
new file mode 100644
index 00000000..e07bf599
--- /dev/null
+++ b/src/math/i386/asinf.s
@@ -0,0 +1 @@
+# see asin.s
diff --git a/src/math/i386/asinl.s b/src/math/i386/asinl.s
new file mode 100644
index 00000000..e07bf599
--- /dev/null
+++ b/src/math/i386/asinl.s
@@ -0,0 +1 @@
+# see asin.s
diff --git a/src/math/i386/atan.s b/src/math/i386/atan.s
new file mode 100644
index 00000000..7e28b395
--- /dev/null
+++ b/src/math/i386/atan.s
@@ -0,0 +1,7 @@
+.global atan
+.type atan,@function
+atan:
+ fldl 4(%esp)
+ fld1
+ fpatan
+ ret
diff --git a/src/math/i386/atan2.s b/src/math/i386/atan2.s
new file mode 100644
index 00000000..5c795aff
--- /dev/null
+++ b/src/math/i386/atan2.s
@@ -0,0 +1,7 @@
+.global atan2
+.type atan2,@function
+atan2:
+ fldl 4(%esp)
+ fldl 12(%esp)
+ fpatan
+ ret
diff --git a/src/math/i386/atan2f.s b/src/math/i386/atan2f.s
new file mode 100644
index 00000000..08627e63
--- /dev/null
+++ b/src/math/i386/atan2f.s
@@ -0,0 +1,7 @@
+.global atan2f
+.type atan2f,@function
+atan2f:
+ flds 4(%esp)
+ flds 8(%esp)
+ fpatan
+ ret
diff --git a/src/math/i386/atan2l.s b/src/math/i386/atan2l.s
new file mode 100644
index 00000000..adf6e10a
--- /dev/null
+++ b/src/math/i386/atan2l.s
@@ -0,0 +1,7 @@
+.global atan2l
+.type atan2l,@function
+atan2l:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ fpatan
+ ret
diff --git a/src/math/i386/atanf.s b/src/math/i386/atanf.s
new file mode 100644
index 00000000..3cd40233
--- /dev/null
+++ b/src/math/i386/atanf.s
@@ -0,0 +1,7 @@
+.global atanf
+.type atanf,@function
+atanf:
+ flds 4(%esp)
+ fld1
+ fpatan
+ ret
diff --git a/src/math/i386/atanl.s b/src/math/i386/atanl.s
new file mode 100644
index 00000000..c508bc46
--- /dev/null
+++ b/src/math/i386/atanl.s
@@ -0,0 +1,7 @@
+.global atanl
+.type atanl,@function
+atanl:
+ fldt 4(%esp)
+ fld1
+ fpatan
+ ret