scalbnf.S 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 "scalbnf.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin scalbnf
  41. .text
  42. .align 16,0x90
  43. .globl scalbnf
  44. scalbnf:
  45. # parameter 1: 16 + %esp
  46. # parameter 2: 20 + %esp
  47. ..B1.1:
  48. ..L1:
  49. pushl %ebx
  50. pushl %ebp
  51. pushl %esi
  52. movzwl 18(%esp), %eax
  53. movl %eax, %ecx
  54. andl $32640, %ecx
  55. shrl $7, %ecx
  56. movl 20(%esp), %edx
  57. cmpl $255, %ecx
  58. je ..B1.15
  59. ..B1.2:
  60. call ..L2
  61. ..L2:
  62. popl %ebx
  63. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx
  64. testl %ecx, %ecx
  65. jne ..B1.5
  66. ..B1.3:
  67. testl $8388607, 16(%esp)
  68. je ..B1.9
  69. ..B1.4:
  70. flds 16(%esp)
  71. fmuls .L_2il0floatpacket.0@GOTOFF(%ebx)
  72. fstps 16(%esp)
  73. movzwl 18(%esp), %eax
  74. movl %eax, %ecx
  75. andl $32640, %ecx
  76. shrl $7, %ecx
  77. addl $-25, %ecx
  78. ..B1.5:
  79. cmpl $65536, %edx
  80. jle ..L3
  81. movl $65536, %edx
  82. ..L3:
  83. cmpl $-65536, %edx
  84. jg ..L4
  85. movl $-65536, %edx
  86. ..L4:
  87. lea (%ecx,%edx), %ebp
  88. testl %ebp, %ebp
  89. jle ..B1.11
  90. ..B1.6:
  91. cmpl $255, %ebp
  92. jge ..B1.10
  93. ..B1.7:
  94. andl $255, %ebp
  95. andl $-32641, %eax
  96. shll $7, %ebp
  97. orl %ebp, %eax
  98. movw %ax, 18(%esp)
  99. flds 16(%esp)
  100. ..B1.8:
  101. popl %ecx
  102. popl %ebp
  103. popl %ebx
  104. ret
  105. ..B1.9:
  106. flds 16(%esp)
  107. popl %ecx
  108. popl %ebp
  109. popl %ebx
  110. ret
  111. ..B1.10:
  112. movzbl 19(%esp), %eax
  113. andl $128, %eax
  114. shrl $7, %eax
  115. flds _large_value_32@GOTOFF(%ebx,%eax,4)
  116. fmuls .L_2il0floatpacket.1@GOTOFF(%ebx)
  117. fsts (%esp)
  118. popl %ecx
  119. popl %ebp
  120. popl %ebx
  121. ret
  122. ..B1.11:
  123. cmpl $-23, %ebp
  124. jl ..B1.14
  125. ..B1.12:
  126. movl 16(%esp), %eax
  127. lea 25(%ecx,%edx), %edx
  128. movl %eax, (%esp)
  129. shrl $16, %eax
  130. movzbl %dl, %edx
  131. andl $-32641, %eax
  132. shll $7, %edx
  133. orl %edx, %eax
  134. movw %ax, 2(%esp)
  135. flds (%esp)
  136. fmuls .L_2il0floatpacket.3@GOTOFF(%ebx)
  137. fsts (%esp)
  138. ..B1.13:
  139. popl %ecx
  140. popl %ebp
  141. popl %ebx
  142. ret
  143. ..B1.14:
  144. movzbl 19(%esp), %eax
  145. andl $128, %eax
  146. shrl $7, %eax
  147. flds _small_value_32@GOTOFF(%ebx,%eax,4)
  148. fmuls .L_2il0floatpacket.2@GOTOFF(%ebx)
  149. fsts (%esp)
  150. popl %ecx
  151. popl %ebp
  152. popl %ebx
  153. ret
  154. ..B1.15:
  155. flds 16(%esp)
  156. popl %ecx
  157. popl %ebp
  158. popl %ebx
  159. ret
  160. .align 16,0x90
  161. .type scalbnf,@function
  162. .size scalbnf,.-scalbnf
  163. .data
  164. # -- End scalbnf
  165. .section .rodata, "a"
  166. .align 4
  167. .align 4
  168. .L_2il0floatpacket.0:
  169. .long 0x4c000000
  170. .type .L_2il0floatpacket.0,@object
  171. .size .L_2il0floatpacket.0,4
  172. .align 4
  173. .L_2il0floatpacket.1:
  174. .long 0x71800000
  175. .type .L_2il0floatpacket.1,@object
  176. .size .L_2il0floatpacket.1,4
  177. .align 4
  178. .L_2il0floatpacket.2:
  179. .long 0x0d800000
  180. .type .L_2il0floatpacket.2,@object
  181. .size .L_2il0floatpacket.2,4
  182. .align 4
  183. .L_2il0floatpacket.3:
  184. .long 0x33000000
  185. .type .L_2il0floatpacket.3,@object
  186. .size .L_2il0floatpacket.3,4
  187. .align 4
  188. _large_value_32:
  189. .long 1904214016
  190. .long 4051697664
  191. .type _large_value_32,@object
  192. .size _large_value_32,8
  193. .align 4
  194. _small_value_32:
  195. .long 226492416
  196. .long 2373976064
  197. .type _small_value_32,@object
  198. .size _small_value_32,8
  199. .data
  200. .section .note.GNU-stack, ""
  201. # End