Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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.  *
  7.  * Removed header file dependency for use in libmingwex.a by
  8.  *   Danny Smith <dannysmith@users.sourceforge.net>
  9.  */
  10.         .file   "logl.S"
  11.         .text
  12.         .align 4
  13. one:    .double 1.0
  14.         /* It is not important that this constant is precise.  It is only
  15.            a value which is known to be on the safe side for using the
  16.            fyl2xp1 instruction.  */
  17. limit:  .double 0.29
  18.  
  19.         .text
  20.         .align 4
  21. .globl _logl
  22.         .def    _logl;  .scl    2;      .type   32;     .endef
  23. _logl:
  24.         fldln2                  /* log(2) */
  25.         fldt    4(%esp)         /* x : log(2) */
  26.         fld     %st             /* x : x : log(2) */
  27.         fsubl   one             /* x-1 : x : log(2) */
  28.         fld     %st             /* x-1 : x-1 : x : log(2) */
  29.         fabs                    /* |x-1| : x-1 : x : log(2) */
  30.         fcompl  limit           /* x-1 : x : log(2) */
  31.         fnstsw                  /* x-1 : x : log(2) */
  32.         andb    $0x45, %ah
  33.         jz      2f
  34.         fstp    %st(1)          /* x-1 : log(2) */
  35.         fyl2xp1                 /* log(x) */
  36.         ret
  37.  
  38. 2:      fstp    %st(0)          /* x : log(2) */
  39.         fyl2x                   /* log(x) */
  40.         ret
  41.