summaryrefslogtreecommitdiff
path: root/src/math/i386
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-13 01:17:53 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-13 01:17:53 -0400
commitb69f695acedd4ce2798ef9ea28d834ceccc789bd (patch)
treeeafd98b9b75160210f3295ac074d699f863d958e /src/math/i386
parentd46cf2e14cc4df7cc75e77d7009fcb6df1f48a33 (diff)
downloadmusl-b69f695acedd4ce2798ef9ea28d834ceccc789bd.tar.gz
musl-b69f695acedd4ce2798ef9ea28d834ceccc789bd.tar.bz2
musl-b69f695acedd4ce2798ef9ea28d834ceccc789bd.tar.xz
musl-b69f695acedd4ce2798ef9ea28d834ceccc789bd.zip
first commit of the new libm!
thanks to the hard work of Szabolcs Nagy (nsz), identifying the best (from correctness and license standpoint) implementations from freebsd and openbsd and cleaning them up! musl should now fully support c99 float and long double math functions, and has near-complete complex math support. tgmath should also work (fully on gcc-compatible compilers, and mostly on any c99 compiler). based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from nsz's libm git repo, with some additions (dummy versions of a few missing long double complex functions, etc.) by me. various cleanups still need to be made, including re-adding (if they're correct) some asm functions that were dropped.
Diffstat (limited to 'src/math/i386')
-rw-r--r--src/math/i386/e_exp.s38
-rw-r--r--src/math/i386/e_expf.s1
-rw-r--r--src/math/i386/e_log.s7
-rw-r--r--src/math/i386/e_log10.s7
-rw-r--r--src/math/i386/e_log10f.s7
-rw-r--r--src/math/i386/e_logf.s7
-rw-r--r--src/math/i386/e_remainder.s18
-rw-r--r--src/math/i386/e_remainderf.s0
-rw-r--r--src/math/i386/s_ceil.s0
-rw-r--r--src/math/i386/s_ceilf.s0
-rw-r--r--src/math/i386/s_fabs.s6
-rw-r--r--src/math/i386/s_fabsf.s6
-rw-r--r--src/math/i386/s_floor.s0
-rw-r--r--src/math/i386/s_floorf.s0
-rw-r--r--src/math/i386/s_ldexp.s0
-rw-r--r--src/math/i386/s_ldexpf.s0
-rw-r--r--src/math/i386/s_rint.s6
-rw-r--r--src/math/i386/s_rintf.s6
-rw-r--r--src/math/i386/s_scalbln.s14
-rw-r--r--src/math/i386/s_scalblnf.s14
-rw-r--r--src/math/i386/s_trunc.s42
-rw-r--r--src/math/i386/s_truncf.s0
-rw-r--r--src/math/i386/sqrt.s (renamed from src/math/i386/e_sqrt.s)0
-rw-r--r--src/math/i386/sqrtf.s (renamed from src/math/i386/e_sqrtf.s)0
-rw-r--r--src/math/i386/sqrtl.s5
25 files changed, 5 insertions, 179 deletions
diff --git a/src/math/i386/e_exp.s b/src/math/i386/e_exp.s
deleted file mode 100644
index c50abc5e..00000000
--- a/src/math/i386/e_exp.s
+++ /dev/null
@@ -1,38 +0,0 @@
-.global expf
-.type expf,@function
-expf:
- mov 4(%esp),%eax
- flds 4(%esp)
- shr $23,%eax
- inc %al
- jz 1f
- jmp 0f
-
-.global exp
-.type exp,@function
-exp:
- mov 8(%esp),%eax
- fldl 4(%esp)
- shl %eax
- cmp $0xffe00000,%eax
- jae 1f
-
-0: fldl2e
- fmulp
- fst %st(1)
- frndint
- fst %st(2)
- fsubrp
- f2xm1
- fld1
- faddp
- fscale
- fstp %st(1)
- ret
-
-1: fsts 4(%esp)
- cmpl $0xff800000,4(%esp)
- jnz 1f
- fstp %st(0)
- fldz
-1: ret
diff --git a/src/math/i386/e_expf.s b/src/math/i386/e_expf.s
deleted file mode 100644
index 8b137891..00000000
--- a/src/math/i386/e_expf.s
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/math/i386/e_log.s b/src/math/i386/e_log.s
deleted file mode 100644
index fcccf030..00000000
--- a/src/math/i386/e_log.s
+++ /dev/null
@@ -1,7 +0,0 @@
-.global log
-.type log,@function
-log:
- fldln2
- fldl 4(%esp)
- fyl2x
- ret
diff --git a/src/math/i386/e_log10.s b/src/math/i386/e_log10.s
deleted file mode 100644
index 28eb5b2f..00000000
--- a/src/math/i386/e_log10.s
+++ /dev/null
@@ -1,7 +0,0 @@
-.global log10
-.type log10,@function
-log10:
- fldlg2
- fldl 4(%esp)
- fyl2x
- ret
diff --git a/src/math/i386/e_log10f.s b/src/math/i386/e_log10f.s
deleted file mode 100644
index c0c0c67e..00000000
--- a/src/math/i386/e_log10f.s
+++ /dev/null
@@ -1,7 +0,0 @@
-.global log10f
-.type log10f,@function
-log10f:
- fldlg2
- flds 4(%esp)
- fyl2x
- ret
diff --git a/src/math/i386/e_logf.s b/src/math/i386/e_logf.s
deleted file mode 100644
index da7ff3ae..00000000
--- a/src/math/i386/e_logf.s
+++ /dev/null
@@ -1,7 +0,0 @@
-.global logf
-.type logf,@function
-logf:
- fldln2
- flds 4(%esp)
- fyl2x
- ret
diff --git a/src/math/i386/e_remainder.s b/src/math/i386/e_remainder.s
deleted file mode 100644
index 36d55f98..00000000
--- a/src/math/i386/e_remainder.s
+++ /dev/null
@@ -1,18 +0,0 @@
-.global remainderf
-.type remainderf,@function
-remainderf:
- flds 8(%esp)
- flds 4(%esp)
- jmp 1f
-
-.global remainder
-.type remainder,@function
-remainder:
- fldl 12(%esp)
- fldl 4(%esp)
-1: fprem1
- fstsw %ax
- sahf
- jp 1b
- fstp %st(1)
- ret
diff --git a/src/math/i386/e_remainderf.s b/src/math/i386/e_remainderf.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/e_remainderf.s
+++ /dev/null
diff --git a/src/math/i386/s_ceil.s b/src/math/i386/s_ceil.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_ceil.s
+++ /dev/null
diff --git a/src/math/i386/s_ceilf.s b/src/math/i386/s_ceilf.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_ceilf.s
+++ /dev/null
diff --git a/src/math/i386/s_fabs.s b/src/math/i386/s_fabs.s
deleted file mode 100644
index d66ea9a1..00000000
--- a/src/math/i386/s_fabs.s
+++ /dev/null
@@ -1,6 +0,0 @@
-.global fabs
-.type fabs,@function
-fabs:
- fldl 4(%esp)
- fabs
- ret
diff --git a/src/math/i386/s_fabsf.s b/src/math/i386/s_fabsf.s
deleted file mode 100644
index a981c422..00000000
--- a/src/math/i386/s_fabsf.s
+++ /dev/null
@@ -1,6 +0,0 @@
-.global fabsf
-.type fabsf,@function
-fabsf:
- flds 4(%esp)
- fabs
- ret
diff --git a/src/math/i386/s_floor.s b/src/math/i386/s_floor.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_floor.s
+++ /dev/null
diff --git a/src/math/i386/s_floorf.s b/src/math/i386/s_floorf.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_floorf.s
+++ /dev/null
diff --git a/src/math/i386/s_ldexp.s b/src/math/i386/s_ldexp.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_ldexp.s
+++ /dev/null
diff --git a/src/math/i386/s_ldexpf.s b/src/math/i386/s_ldexpf.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_ldexpf.s
+++ /dev/null
diff --git a/src/math/i386/s_rint.s b/src/math/i386/s_rint.s
deleted file mode 100644
index bb99a11c..00000000
--- a/src/math/i386/s_rint.s
+++ /dev/null
@@ -1,6 +0,0 @@
-.global rint
-.type rint,@function
-rint:
- fldl 4(%esp)
- frndint
- ret
diff --git a/src/math/i386/s_rintf.s b/src/math/i386/s_rintf.s
deleted file mode 100644
index bce4c5a6..00000000
--- a/src/math/i386/s_rintf.s
+++ /dev/null
@@ -1,6 +0,0 @@
-.global rintf
-.type rintf,@function
-rintf:
- flds 4(%esp)
- frndint
- ret
diff --git a/src/math/i386/s_scalbln.s b/src/math/i386/s_scalbln.s
deleted file mode 100644
index 2641e694..00000000
--- a/src/math/i386/s_scalbln.s
+++ /dev/null
@@ -1,14 +0,0 @@
-.global ldexp
-.global scalbn
-.global scalbln
-.type ldexp,@function
-.type scalbn,@function
-.type scalbln,@function
-ldexp:
-scalbn:
-scalbln:
- fildl 12(%esp)
- fldl 4(%esp)
- fscale
- fstp %st(1)
- ret
diff --git a/src/math/i386/s_scalblnf.s b/src/math/i386/s_scalblnf.s
deleted file mode 100644
index 775765a3..00000000
--- a/src/math/i386/s_scalblnf.s
+++ /dev/null
@@ -1,14 +0,0 @@
-.global ldexpf
-.global scalbnf
-.global scalblnf
-.type ldexpf,@function
-.type scalbnf,@function
-.type scalblnf,@function
-ldexpf:
-scalbnf:
-scalblnf:
- fildl 8(%esp)
- flds 4(%esp)
- fscale
- fstp %st(1)
- ret
diff --git a/src/math/i386/s_trunc.s b/src/math/i386/s_trunc.s
deleted file mode 100644
index bdd6ab4c..00000000
--- a/src/math/i386/s_trunc.s
+++ /dev/null
@@ -1,42 +0,0 @@
-.global ceilf
-.type ceilf,@function
-ceilf: flds 4(%esp)
- jmp 1f
-
-.global ceil
-.type ceil,@function
-ceil: fldl 4(%esp)
-1: mov $0x08fb,%edx
- jmp 0f
-
-.global floorf
-.type floorf,@function
-floorf: flds 4(%esp)
- jmp 1f
-
-.global floor
-.type floor,@function
-floor: fldl 4(%esp)
-1: mov $0x04f7,%edx
- jmp 0f
-
-.global truncf
-.type truncf,@function
-truncf: flds 4(%esp)
- jmp 1f
-
-.global trunc
-.type trunc,@function
-trunc: fldl 4(%esp)
-1: mov $0x0cff,%edx
-
-0: fstcw 4(%esp)
- mov 5(%esp),%ah
- or %dh,%ah
- and %dl,%ah
- xchg %ah,5(%esp)
- fldcw 4(%esp)
- frndint
- mov %ah,5(%esp)
- fldcw 4(%esp)
- ret
diff --git a/src/math/i386/s_truncf.s b/src/math/i386/s_truncf.s
deleted file mode 100644
index e69de29b..00000000
--- a/src/math/i386/s_truncf.s
+++ /dev/null
diff --git a/src/math/i386/e_sqrt.s b/src/math/i386/sqrt.s
index c6e55303..c6e55303 100644
--- a/src/math/i386/e_sqrt.s
+++ b/src/math/i386/sqrt.s
diff --git a/src/math/i386/e_sqrtf.s b/src/math/i386/sqrtf.s
index b79bd949..b79bd949 100644
--- a/src/math/i386/e_sqrtf.s
+++ b/src/math/i386/sqrtf.s
diff --git a/src/math/i386/sqrtl.s b/src/math/i386/sqrtl.s
new file mode 100644
index 00000000..e0d42616
--- /dev/null
+++ b/src/math/i386/sqrtl.s
@@ -0,0 +1,5 @@
+.global sqrtl
+.type sqrtl,@function
+sqrtl: fldt 4(%esp)
+ fsqrt
+ ret