blob: ec6e566d56a1658c7be66cf21a42f60acde60dbc [file] [log] [blame]
Kai Tietz518dd332007-08-10 09:54:15 +00001/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 *
5 * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
6* Removed header file dependency for use in libmingwex.a by
7 * Danny Smith <dannysmith@users.sourceforge.net>
8 */
9
10 .file "log1pl.S"
11 .text
12 .align 4
13 /* The fyl2xp1 can only be used for values in
14 -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
15 0.29 is a safe value.
16 */
17limit: .tfloat 0.29
18 /* Please note: we use a double value here. Since 1.0 has
19 an exact representation this does not effect the accuracy
20 but it helps to optimize the code. */
21one: .double 1.0
22
23/*
24 * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
25 * otherwise fyl2x with the needed extra computation.
26 */
27.globl _log1pl;
28 .def _log1pl; .scl 2; .type 32; .endef
29_log1pl:
30 fldln2
31 fldt 4(%esp)
32 fxam
33 fnstsw
34 fld %st
35 sahf
36 jc 3f // in case x is NaN or ±Inf
374:
38 fabs
39 fldt limit
40 fcompp
41 fnstsw
42 sahf
43 jnc 2f
44 faddl one
45 fyl2x
46 ret
47
482: fyl2xp1
49 ret
50
513: jp 4b // in case x is ±Inf
52 fstp %st(1)
53 fstp %st(1)
54 ret