Kai Tietz | 518dd33 | 2007-08-10 09:54:15 +0000 | [diff] [blame^] | 1 | /*
|
| 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 | */
|
| 17 | limit: .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. */
|
| 21 | one: .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
|
| 37 | 4:
|
| 38 | fabs
|
| 39 | fldt limit
|
| 40 | fcompp
|
| 41 | fnstsw
|
| 42 | sahf
|
| 43 | jnc 2f
|
| 44 | faddl one
|
| 45 | fyl2x
|
| 46 | ret
|
| 47 |
|
| 48 | 2: fyl2xp1
|
| 49 | ret
|
| 50 |
|
| 51 | 3: jp 4b // in case x is ±Inf
|
| 52 | fstp %st(1)
|
| 53 | fstp %st(1)
|
| 54 | ret
|