ilogbl.S 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Math library
  3. *
  4. * Copyright (C) 2016 Intel Corporation. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the name of Intel Corporation nor the names of its
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. *
  33. * Author Name <jingwei.zhang@intel.com>
  34. * History:
  35. * 03-14-2016 Initial version. numerics svn rev. 12864
  36. */
  37. .file "ilogbl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin ilogbl
  41. .text
  42. .align 16,0x90
  43. .globl ilogbl
  44. ilogbl:
  45. # parameter 1: 8 + %ebp
  46. ..B1.1:
  47. ..L1:
  48. pushl %ebp
  49. movl %esp, %ebp
  50. andl $-16, %esp
  51. subl $32, %esp
  52. ..B1.2:
  53. fnstcw 14(%esp)
  54. ..B1.3:
  55. movzwl 16(%ebp), %eax
  56. andl $32767, %eax
  57. call ..L2
  58. ..L2:
  59. popl %edx
  60. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx
  61. cmpl $32767, %eax
  62. je ..B1.20
  63. ..B1.4:
  64. testl %eax, %eax
  65. jne ..B1.13
  66. ..B1.5:
  67. cmpl $0, 12(%ebp)
  68. jne ..B1.7
  69. ..B1.6:
  70. cmpl $0, 8(%ebp)
  71. je ..B1.14
  72. ..B1.7:
  73. movzwl 14(%esp), %ecx
  74. movl %ecx, %eax
  75. andl $768, %eax
  76. cmpl $768, %eax
  77. je ..B1.19
  78. ..B1.8:
  79. orl $-64768, %ecx
  80. movw %cx, 12(%esp)
  81. ..B1.9:
  82. fldcw 12(%esp)
  83. ..B1.10:
  84. fldt 8(%ebp)
  85. fmull _TWO_75@GOTOFF(%edx)
  86. fstpt 8(%ebp)
  87. ..B1.11:
  88. fldcw 14(%esp)
  89. ..B1.12:
  90. movzwl 16(%ebp), %eax
  91. andl $32767, %eax
  92. addl $-16458, %eax
  93. movl %ebp, %esp
  94. popl %ebp
  95. ret
  96. ..B1.13:
  97. addl $-16383, %eax
  98. movl %ebp, %esp
  99. popl %ebp
  100. ret
  101. ..B1.14:
  102. movzwl 14(%esp), %ecx
  103. movl %ecx, %eax
  104. andl $768, %eax
  105. cmpl $768, %eax
  106. je ..B1.18
  107. ..B1.15:
  108. orl $-64768, %ecx
  109. movw %cx, 12(%esp)
  110. ..B1.16:
  111. fldcw 12(%esp)
  112. ..B1.17:
  113. fldcw 14(%esp)
  114. ..B1.18:
  115. fldl _infs@GOTOFF(%edx)
  116. movl $-2147483648, %eax
  117. fmull _zeros@GOTOFF(%edx)
  118. fstpl 16(%esp)
  119. movl %ebp, %esp
  120. popl %ebp
  121. ret
  122. ..B1.19:
  123. fldt 8(%ebp)
  124. fmull _TWO_75@GOTOFF(%edx)
  125. fstpt 8(%ebp)
  126. jmp ..B1.12
  127. ..B1.20:
  128. cmpl $-2147483648, 12(%ebp)
  129. fldl _infs@GOTOFF(%edx)
  130. fmull _zeros@GOTOFF(%edx)
  131. fstpl 16(%esp)
  132. jne ..B1.23
  133. ..B1.21:
  134. cmpl $0, 8(%ebp)
  135. jne ..B1.23
  136. ..B1.22:
  137. movl $2147483647, %eax
  138. movl %ebp, %esp
  139. popl %ebp
  140. ret
  141. ..B1.23:
  142. movzwl 14(%esp), %edx
  143. movl %edx, %eax
  144. andl $768, %eax
  145. cmpl $768, %eax
  146. je ..B1.29
  147. ..B1.24:
  148. orl $-64768, %edx
  149. movw %dx, 12(%esp)
  150. ..B1.25:
  151. fldcw 12(%esp)
  152. ..B1.26:
  153. fldt 8(%ebp)
  154. fstpt (%esp)
  155. ..B1.27:
  156. fldcw 14(%esp)
  157. ..B1.28:
  158. movl $-2147483648, %eax
  159. movl %ebp, %esp
  160. popl %ebp
  161. ret
  162. ..B1.29:
  163. fldt 8(%ebp)
  164. fstpt (%esp)
  165. jmp ..B1.28
  166. .align 16,0x90
  167. .type ilogbl,@function
  168. .size ilogbl,.-ilogbl
  169. .data
  170. # -- End ilogbl
  171. .section .rodata, "a"
  172. .align 4
  173. .align 4
  174. _TWO_75:
  175. .long 0
  176. .long 1151336448
  177. .long 0
  178. .long 994050048
  179. .type _TWO_75,@object
  180. .size _TWO_75,16
  181. .align 4
  182. _infs:
  183. .long 0
  184. .long 2146435072
  185. .long 0
  186. .long 4293918720
  187. .type _infs,@object
  188. .size _infs,16
  189. .align 4
  190. _zeros:
  191. .long 0
  192. .long 0
  193. .long 0
  194. .long 2147483648
  195. .type _zeros,@object
  196. .size _zeros,16
  197. .data
  198. .section .note.GNU-stack, ""
  199. # End