sqrtl.S 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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: 64 + %rsp
  46. ..B1.1:
  47. .cfi_startproc
  48. ..___tag_value_sqrtl.1:
  49. ..L2:
  50. subq $56, %rsp
  51. .cfi_def_cfa_offset 64
  52. xorb %cl, %cl
  53. fldt 64(%rsp)
  54. fstpt 32(%rsp)
  55. ..B1.2:
  56. fnstcw 10(%rsp)
  57. ..B1.3:
  58. movzwl 72(%rsp), %eax
  59. andl $32767, %eax
  60. cmpl $32767, %eax
  61. je ..B1.23
  62. ..B1.4:
  63. testb $-128, 73(%rsp)
  64. jne ..B1.13
  65. ..B1.5:
  66. movzwl 10(%rsp), %edx
  67. movl %edx, %eax
  68. andl $768, %eax
  69. cmpl $768, %eax
  70. je ..B1.9
  71. ..B1.6:
  72. orl $-64768, %edx
  73. movw %dx, 8(%rsp)
  74. ..B1.7:
  75. fldcw 8(%rsp)
  76. ..B1.8:
  77. movb $1, %cl
  78. ..B1.9:
  79. fldt 32(%rsp)
  80. fsqrt
  81. fstpt 16(%rsp)
  82. ..B1.10:
  83. testb %cl, %cl
  84. je ..B1.12
  85. ..B1.11:
  86. fldcw 10(%rsp)
  87. ..B1.12:
  88. fldt 16(%rsp)
  89. addq $56, %rsp
  90. .cfi_def_cfa_offset 8
  91. ret
  92. .cfi_def_cfa_offset 64
  93. ..B1.13:
  94. testl %eax, %eax
  95. jne ..B1.16
  96. ..B1.14:
  97. cmpq $0, 64(%rsp)
  98. jne ..B1.16
  99. ..B1.15:
  100. fldt 64(%rsp)
  101. addq $56, %rsp
  102. .cfi_def_cfa_offset 8
  103. ret
  104. .cfi_def_cfa_offset 64
  105. ..B1.16:
  106. movzwl 10(%rsp), %edx
  107. movl %edx, %eax
  108. andl $768, %eax
  109. cmpl $768, %eax
  110. je ..B1.20
  111. ..B1.17:
  112. orl $-64768, %edx
  113. movw %dx, 8(%rsp)
  114. ..B1.18:
  115. fldcw 8(%rsp)
  116. ..B1.19:
  117. movb $1, %cl
  118. ..B1.20:
  119. lea _infs(%rip), %rax
  120. lea _zeros(%rip), %rdx
  121. testb %cl, %cl
  122. movsd (%rax), %xmm0
  123. mulsd (%rdx), %xmm0
  124. movsd %xmm0, (%rsp)
  125. fldl (%rsp)
  126. fstpt 16(%rsp)
  127. je ..B1.22
  128. ..B1.21:
  129. fldcw 10(%rsp)
  130. ..B1.22:
  131. fldt 16(%rsp)
  132. addq $56, %rsp
  133. .cfi_def_cfa_offset 8
  134. ret
  135. .cfi_def_cfa_offset 64
  136. ..B1.23:
  137. cmpl $-2147483648, 68(%rsp)
  138. jne ..B1.25
  139. ..B1.24:
  140. cmpl $0, 64(%rsp)
  141. je ..B1.4
  142. ..B1.25:
  143. movzwl 10(%rsp), %edx
  144. movl %edx, %eax
  145. andl $768, %eax
  146. cmpl $768, %eax
  147. je ..B1.31
  148. ..B1.26:
  149. orl $-64768, %edx
  150. movw %dx, 8(%rsp)
  151. ..B1.27:
  152. fldcw 8(%rsp)
  153. ..B1.28:
  154. fldt 64(%rsp)
  155. lea _ones(%rip), %rax
  156. fmull (%rax)
  157. fstpt 16(%rsp)
  158. ..B1.29:
  159. fldcw 10(%rsp)
  160. ..B1.30:
  161. fldt 16(%rsp)
  162. addq $56, %rsp
  163. .cfi_def_cfa_offset 8
  164. ret
  165. .cfi_def_cfa_offset 64
  166. ..B1.31:
  167. fldt 64(%rsp)
  168. lea _ones(%rip), %rax
  169. fmull (%rax)
  170. fstpt 16(%rsp)
  171. jmp ..B1.30
  172. .align 16,0x90
  173. .cfi_endproc
  174. .type sqrtl,@function
  175. .size sqrtl,.-sqrtl
  176. .data
  177. # -- End sqrtl
  178. .section .rodata, "a"
  179. .align 4
  180. .align 4
  181. _infs:
  182. .long 0
  183. .long 2146435072
  184. .long 0
  185. .long 4293918720
  186. .type _infs,@object
  187. .size _infs,16
  188. .align 4
  189. _zeros:
  190. .long 0
  191. .long 0
  192. .long 0
  193. .long 2147483648
  194. .type _zeros,@object
  195. .size _zeros,16
  196. .align 4
  197. _ones:
  198. .long 0
  199. .long 1072693248
  200. .long 0
  201. .long 3220176896
  202. .type _ones,@object
  203. .size _ones,16
  204. .data
  205. .section .note.GNU-stack, ""
  206. // -- Begin DWARF2 SEGMENT .eh_frame
  207. .section .eh_frame,"a",@progbits
  208. .eh_frame_seg:
  209. .align 1
  210. # End