q2l.S 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 "q2l.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin __qtol
  41. .text
  42. .align 16,0x90
  43. .globl __qtol
  44. __qtol:
  45. # parameter 1: %rdi
  46. ..B1.1:
  47. .cfi_startproc
  48. ..___tag_value___qtol.1:
  49. ..L2:
  50. subq $40, %rsp
  51. .cfi_def_cfa_offset 48
  52. movq %rdi, %rdx
  53. movq $0xffffffffffff, %rcx
  54. movq 8(%rdx), %rax
  55. movq %rax, %rsi
  56. shrq $48, %rsi
  57. andq %rax, %rcx
  58. movq (%rdx), %rdi
  59. movq %rdi, %r8
  60. movl %esi, %edx
  61. shlq $15, %rcx
  62. andl $32767, %edx
  63. shrq $49, %r8
  64. shlq $15, %rdi
  65. orq %r8, %rcx
  66. cmpl $32767, %edx
  67. jne ..B1.7
  68. ..B1.2:
  69. orq %rcx, %rdi
  70. je ..B1.6
  71. ..B1.3:
  72. movq $0x4000000000000000, %rdx
  73. testq %rcx, %rdx
  74. jne ..B1.5
  75. ..B1.4:
  76. movq p_zero(%rip), %rax
  77. movsd (%rax), %xmm0
  78. divsd %xmm0, %xmm0
  79. movsd %xmm0, (%rsp)
  80. ..B1.5:
  81. orq %rdx, %rcx
  82. ..B1.6:
  83. btsq $63, %rcx
  84. movl %esi, 24(%rsp)
  85. movq %rcx, 16(%rsp)
  86. fldt 16(%rsp)
  87. addq $40, %rsp
  88. .cfi_def_cfa_offset 8
  89. ret
  90. .cfi_def_cfa_offset 48
  91. ..B1.7:
  92. testl %edx, %edx
  93. je ..B1.9
  94. ..B1.8:
  95. movq $0x8000000000000000, %rax
  96. orq %rax, %rcx
  97. jmp ..B1.11
  98. ..B1.9:
  99. movq %rcx, %rax
  100. orq %rdi, %rax
  101. je ..B1.22
  102. ..B1.10:
  103. movq p_tiny(%rip), %rax
  104. movq p_one(%rip), %r8
  105. movsd (%rax), %xmm0
  106. mulsd (%r8), %xmm0
  107. movsd %xmm0, (%rsp)
  108. ..B1.11:
  109. testq %rdi, %rdi
  110. je ..B1.21
  111. ..B1.12:
  112. stmxcsr 8(%rsp)
  113. ..B1.13:
  114. movl 8(%rsp), %eax
  115. shrl $3, %eax
  116. andl $3072, %eax
  117. jne ..B1.15
  118. ..B1.14:
  119. testq %rdi, %rdi
  120. jl ..B1.23
  121. jmp ..B1.18
  122. ..B1.15:
  123. testl $32768, %esi
  124. je ..B1.17
  125. ..B1.16:
  126. cmpl $1024, %eax
  127. je ..B1.23
  128. jmp ..B1.18
  129. ..B1.17:
  130. cmpl $2048, %eax
  131. je ..B1.23
  132. ..B1.18:
  133. testl %edx, %edx
  134. jne ..B1.20
  135. ..B1.19:
  136. movq p_norm(%rip), %rax
  137. movsd (%rax), %xmm0
  138. mulsd %xmm0, %xmm0
  139. movsd %xmm0, (%rsp)
  140. jmp ..B1.21
  141. ..B1.20:
  142. movq p_one(%rip), %rax
  143. movq p_norm(%rip), %rdx
  144. movsd (%rax), %xmm0
  145. addsd (%rdx), %xmm0
  146. movsd %xmm0, (%rsp)
  147. ..B1.21:
  148. movl %esi, 24(%rsp)
  149. movq %rcx, 16(%rsp)
  150. fldt 16(%rsp)
  151. addq $40, %rsp
  152. .cfi_def_cfa_offset 8
  153. ret
  154. .cfi_def_cfa_offset 48
  155. ..B1.22:
  156. movl %esi, 24(%rsp)
  157. movq $0, 16(%rsp)
  158. fldt 16(%rsp)
  159. addq $40, %rsp
  160. .cfi_def_cfa_offset 8
  161. ret
  162. .cfi_def_cfa_offset 48
  163. ..B1.23:
  164. incq %rcx
  165. testl %edx, %edx
  166. je ..B1.29
  167. ..B1.24:
  168. testq %rcx, %rcx
  169. jne ..B1.28
  170. ..B1.25:
  171. incl %esi
  172. movq $0x8000000000000000, %rcx
  173. movl %esi, %edx
  174. andl $32767, %edx
  175. ..B1.26:
  176. cmpl $32767, %edx
  177. jne ..B1.18
  178. ..B1.27:
  179. movq p_huge(%rip), %rax
  180. movsd (%rax), %xmm0
  181. mulsd %xmm0, %xmm0
  182. movsd %xmm0, (%rsp)
  183. jmp ..B1.21
  184. ..B1.28:
  185. movq $0x8000000000000000, %rdx
  186. movl $1, %r8d
  187. cmpq %rdi, %rdx
  188. movl $0, %edi
  189. movq p_one(%rip), %r9
  190. movq p_norm(%rip), %r10
  191. cmove %r8d, %edi
  192. testl %eax, %eax
  193. movl $0, %eax
  194. movsd (%r9), %xmm0
  195. cmove %r8d, %eax
  196. addsd (%r10), %xmm0
  197. andl %eax, %edi
  198. notl %edi
  199. movslq %edi, %rdi
  200. movsd %xmm0, (%rsp)
  201. andq %rdi, %rcx
  202. jmp ..B1.21
  203. ..B1.29:
  204. movq $0x8000000000000000, %rdx
  205. movl $1, %r8d
  206. cmpq %rdi, %rdx
  207. movl $0, %edi
  208. cmove %r8d, %edi
  209. testl %eax, %eax
  210. movl $0, %eax
  211. cmove %r8d, %eax
  212. andl %eax, %edi
  213. notl %edi
  214. movslq %edi, %rdi
  215. andq %rdi, %rcx
  216. jge ..B1.19
  217. ..B1.30:
  218. incl %esi
  219. movl %esi, %edx
  220. andl $32767, %edx
  221. jmp ..B1.26
  222. .align 16,0x90
  223. .cfi_endproc
  224. .type __qtol,@function
  225. .size __qtol,.-__qtol
  226. .data
  227. # -- End __qtol
  228. .data
  229. .align 8
  230. .align 8
  231. p_zero:
  232. .quad d_zero
  233. .type p_zero,@object
  234. .size p_zero,8
  235. .align 8
  236. p_tiny:
  237. .quad d_tiny
  238. .type p_tiny,@object
  239. .size p_tiny,8
  240. .align 8
  241. p_one:
  242. .quad d_one
  243. .type p_one,@object
  244. .size p_one,8
  245. .align 8
  246. p_norm:
  247. .quad d_norm
  248. .type p_norm,@object
  249. .size p_norm,8
  250. .align 8
  251. p_huge:
  252. .quad d_huge
  253. .type p_huge,@object
  254. .size p_huge,8
  255. .section .rodata, "a"
  256. .align 8
  257. .align 8
  258. d_zero:
  259. .long 0x00000000,0x00000000
  260. .type d_zero,@object
  261. .size d_zero,8
  262. .align 8
  263. d_tiny:
  264. .long 0x00000001,0x00000000
  265. .type d_tiny,@object
  266. .size d_tiny,8
  267. .align 8
  268. d_one:
  269. .long 0x00000000,0x3ff00000
  270. .type d_one,@object
  271. .size d_one,8
  272. .align 8
  273. d_norm:
  274. .long 0x00000000,0x00100000
  275. .type d_norm,@object
  276. .size d_norm,8
  277. .align 8
  278. d_huge:
  279. .long 0xffffffff,0x7fefffff
  280. .type d_huge,@object
  281. .size d_huge,8
  282. .data
  283. .section .note.GNU-stack, ""
  284. // -- Begin DWARF2 SEGMENT .eh_frame
  285. .section .eh_frame,"a",@progbits
  286. .eh_frame_seg:
  287. .align 1
  288. # End