sqrtl.S 4.9 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 "sqrtl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin sqrtl
  41. .text
  42. .align 16,0x90
  43. .globl sqrtl
  44. sqrtl:
  45. # parameter 1: 32 + %esp
  46. ..B1.1:
  47. ..L1:
  48. subl $28, %esp
  49. ..B1.2:
  50. fnstcw 14(%esp)
  51. ..B1.3:
  52. movzwl 40(%esp), %ecx
  53. andl $32767, %ecx
  54. call ..L2
  55. ..L2:
  56. popl %eax
  57. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
  58. cmpl $32767, %ecx
  59. je ..B1.26
  60. ..B1.4:
  61. movzbl 41(%esp), %edx
  62. testl $128, %edx
  63. jne ..B1.14
  64. ..B1.5:
  65. movzwl 14(%esp), %edx
  66. movl %edx, %eax
  67. andl $768, %eax
  68. cmpl $768, %eax
  69. je ..B1.13
  70. ..B1.6:
  71. orl $-64768, %edx
  72. movw %dx, 12(%esp)
  73. ..B1.7:
  74. fldcw 12(%esp)
  75. ..B1.8:
  76. movl $1, %eax
  77. ..B1.9:
  78. fldt 32(%esp)
  79. fsqrt
  80. fstpt (%esp)
  81. ..B1.10:
  82. testl %eax, %eax
  83. je ..B1.12
  84. ..B1.11:
  85. fldcw 14(%esp)
  86. ..B1.12:
  87. fldt (%esp)
  88. addl $28, %esp
  89. ret
  90. ..B1.13:
  91. xorl %eax, %eax
  92. jmp ..B1.9
  93. ..B1.14:
  94. testl %ecx, %ecx
  95. jne ..B1.18
  96. ..B1.15:
  97. cmpl $0, 36(%esp)
  98. jne ..B1.18
  99. ..B1.16:
  100. cmpl $0, 32(%esp)
  101. jne ..B1.18
  102. ..B1.17:
  103. fldt 32(%esp)
  104. addl $28, %esp
  105. ret
  106. ..B1.18:
  107. movzwl 14(%esp), %ecx
  108. movl %ecx, %edx
  109. andl $768, %edx
  110. cmpl $768, %edx
  111. je ..B1.25
  112. ..B1.19:
  113. orl $-64768, %ecx
  114. movw %cx, 12(%esp)
  115. ..B1.20:
  116. fldcw 12(%esp)
  117. ..B1.21:
  118. movl $1, %edx
  119. ..B1.22:
  120. fldl _infs@GOTOFF(%eax)
  121. testl %edx, %edx
  122. fmull _zeros@GOTOFF(%eax)
  123. fstpt (%esp)
  124. je ..B1.24
  125. ..B1.23:
  126. fldcw 14(%esp)
  127. ..B1.24:
  128. fldt (%esp)
  129. addl $28, %esp
  130. ret
  131. ..B1.25:
  132. xorl %edx, %edx
  133. jmp ..B1.22
  134. ..B1.26:
  135. cmpl $-2147483648, 36(%esp)
  136. jne ..B1.28
  137. ..B1.27:
  138. cmpl $0, 32(%esp)
  139. je ..B1.4
  140. ..B1.28:
  141. movzwl 14(%esp), %ecx
  142. movl %ecx, %edx
  143. andl $768, %edx
  144. cmpl $768, %edx
  145. je ..B1.34
  146. ..B1.29:
  147. orl $-64768, %ecx
  148. movw %cx, 12(%esp)
  149. ..B1.30:
  150. fldcw 12(%esp)
  151. ..B1.31:
  152. fldt 32(%esp)
  153. fmull _ones@GOTOFF(%eax)
  154. fstpt (%esp)
  155. ..B1.32:
  156. fldcw 14(%esp)
  157. ..B1.33:
  158. fldt (%esp)
  159. addl $28, %esp
  160. ret
  161. ..B1.34:
  162. fldt 32(%esp)
  163. fmull _ones@GOTOFF(%eax)
  164. fstpt (%esp)
  165. jmp ..B1.33
  166. .align 16,0x90
  167. .type sqrtl,@function
  168. .size sqrtl,.-sqrtl
  169. .data
  170. # -- End sqrtl
  171. .section .rodata, "a"
  172. .align 4
  173. .align 4
  174. _infs:
  175. .long 0
  176. .long 2146435072
  177. .long 0
  178. .long 4293918720
  179. .type _infs,@object
  180. .size _infs,16
  181. .align 4
  182. _zeros:
  183. .long 0
  184. .long 0
  185. .long 0
  186. .long 2147483648
  187. .type _zeros,@object
  188. .size _zeros,16
  189. .align 4
  190. _ones:
  191. .long 0
  192. .long 1072693248
  193. .long 0
  194. .long 3220176896
  195. .type _ones,@object
  196. .size _ones,16
  197. .data
  198. .section .note.GNU-stack, ""
  199. # End