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.  * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
  4.  * Public domain.
  5.  */
  6.  
  7.         .file   "ilogbl.S"
  8.         .text
  9.         .align 4
  10. .globl _ilogbl
  11.         .def    _ilogbl;        .scl    2;      .type   32;     .endef
  12. _ilogbl:
  13.         fldt    4(%esp)
  14. /* I added the following ugly construct because ilogb(+-Inf) is
  15.    required to return INT_MAX in ISO C99.
  16.    -- jakub@redhat.com.  */
  17.         fxam                    /* Is NaN or +-Inf?  */
  18.         fstsw   %ax
  19.         movb    $0x45, %dh
  20.         andb    %ah, %dh
  21.         cmpb    $0x05, %dh
  22.         je      1f              /* Is +-Inf, jump.  */
  23.  
  24.         fxtract
  25.         pushl   %eax
  26.         fstp    %st
  27.  
  28.         fistpl  (%esp)
  29.         fwait
  30.         popl    %eax
  31.  
  32.         ret
  33.  
  34. 1:      fstp    %st
  35.         movl    $0x7fffffff, %eax
  36.         ret
  37.