home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / sysdeps / linux / i386 / math / exp.S < prev    next >
Encoding:
Text File  |  1994-09-21  |  2.4 KB  |  170 lines

  1. /*
  2. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  3. **
  4. ** Modified O.ROBERT 24, Avenue de Verdun 92170 VANVES, FRANCE
  5. **
  6. ** E-mail: roberto@germinal.ibp.fr
  7. **
  8. ** This file is distributed under the terms listed in the document
  9. ** "copying.dj", available from DJ Delorie at the address above.
  10. ** A copy of "copying.dj" should accompany this file; if not, a copy
  11. ** should be available from where this file was obtained.  This file
  12. ** may not be distributed without a verbatim copy of "copying.dj".
  13. **
  14. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  15. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. **
  17. ** or    03-Apr-1991    corrected bug about argument zero to pow
  18. **            fyl2x didn't like it
  19. */
  20.  
  21. /* Modified by H.J. Lu for Linux, 1992 */
  22. /* Modified by J.-H. Rechtien, 2.2.1994 */
  23.  
  24. /* History:15,24 */
  25.  
  26.     .file    "exp.S"
  27.  
  28. #ifdef __ELF__
  29. #define _exp    exp
  30. #define _pow10    pow10
  31. #define _pow2    pow2
  32. #endif
  33.  
  34. #ifdef __ELF__
  35.     .section    .rodata
  36. #else
  37.     .text
  38. #endif
  39.  
  40. #ifdef __i486__
  41.     .align    4,0x90
  42. #else
  43.     .align    2,0x90
  44. #endif
  45.  
  46. #ifdef __ELF__
  47. .LC0:
  48. #else
  49. LC0:
  50. #endif
  51.     .double    0d1.0000000000000000000e+00
  52.  
  53.     .text
  54.     .globl    _exp
  55. #ifdef __i486__
  56.     .align    4,0x90
  57. #else
  58.     .align    2,0x90
  59. #endif
  60.  
  61. _exp:
  62.     pushl    %ebp
  63.     movl    %esp,%ebp
  64.     subl    $8,%esp
  65. #ifdef __PIC__
  66.     pushl    %ebx
  67.     call    .L2
  68. .L2:
  69.     popl    %ebx
  70.     addl    $_GLOBAL_OFFSET_TABLE_+[.-.L2],%ebx
  71. #endif
  72.     fldl    8(%ebp)
  73.     fldl2e
  74.     fmulp    %st,%st(1)
  75. #ifdef __ELF__
  76.     jmp    .L1
  77. #else
  78.     jmp    L1
  79. #endif
  80.  
  81.     .globl    _pow10
  82.  
  83. #ifdef __i486__
  84.     .align    4,0x90
  85. #else
  86.     .align    2,0x90
  87. #endif
  88.  
  89. _pow10:
  90.     pushl    %ebp
  91.     movl    %esp,%ebp
  92.     subl    $8,%esp
  93. #ifdef __PIC__
  94.     pushl    %ebx
  95.     call    .L3
  96. .L3:
  97.     popl    %ebx
  98.     addl    $_GLOBAL_OFFSET_TABLE_+[.-.L3],%ebx
  99. #endif
  100.     fldl    8(%ebp)
  101.     fldl2t
  102.     fmulp    %st,%st(1)
  103. #ifdef __ELF__
  104.     jmp    .L1
  105. #else
  106.     jmp    L1
  107. #endif
  108.  
  109.     .globl    _pow2
  110. #ifdef __i486__
  111.     .align    4,0x90
  112. #else
  113.     .align    2,0x90
  114. #endif
  115.  
  116. _pow2:
  117.     pushl    %ebp
  118.     movl    %esp,%ebp
  119.     subl    $8,%esp
  120. #ifdef __PIC__
  121.     pushl    %ebx
  122.     call    .L4
  123. .L4:
  124.     popl    %ebx
  125.     addl    $_GLOBAL_OFFSET_TABLE_+[.-.L4],%ebx
  126. #endif
  127.     fldl    8(%ebp)
  128.  
  129. #ifdef __ELF__
  130. .L1:
  131. #else
  132. L1:
  133. #endif
  134.     fstcw    -4(%ebp)
  135.     fstcw    -8(%ebp)
  136.     fwait
  137.     andw    $0xf3ff,-4(%ebp)
  138.     fldcw    -4(%ebp)
  139.     fldl    %st(0)
  140.     frndint
  141.     fldcw    -8(%ebp)
  142.     fxch    %st(1)
  143.     fsub    %st(1),%st
  144.     f2xm1
  145.     fwait            
  146. #ifdef __PIC__
  147.     faddl    .LC0@GOTOFF(%ebx)
  148. #else
  149. #ifdef __ELF__
  150.     faddl    .LC0
  151. #else
  152.     faddl    LC0
  153. #endif
  154. #endif
  155.     fscale
  156.     fstp    %st(1)
  157.  
  158. #ifdef __PIC__
  159.     popl    %ebx
  160. #endif
  161.     movl    %ebp,%esp
  162.     popl    %ebp
  163.     ret
  164.  
  165. #ifdef __ELF__
  166.     .type    exp,@function
  167.     .type    pow10,@function
  168.     .type    pow2,@function
  169. #endif
  170.