libm_mul_k64.S 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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 "libm_mul_k64.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin __libm_mul_k64
  41. .text
  42. .align 16,0x90
  43. .globl __libm_mul_k64
  44. __libm_mul_k64:
  45. # parameter 1: %edi
  46. # parameter 2: %rsi
  47. # parameter 3: %rdx
  48. # parameter 4: %rcx
  49. ..B1.1:
  50. .cfi_startproc
  51. ..___tag_value___libm_mul_k64.1:
  52. ..L2:
  53. movq %rdx, %rax
  54. movzwl 6(%rsi), %edx
  55. andl $32752, %edx
  56. shrl $4, %edx
  57. movsd (%rsi), %xmm3
  58. cmpl $2047, %edx
  59. movsd 8(%rsi), %xmm7
  60. movsd (%rax), %xmm2
  61. movsd 8(%rax), %xmm4
  62. je ..B1.12
  63. ..B1.2:
  64. testl %edx, %edx
  65. jne ..B1.7
  66. ..B1.3:
  67. testl $1048575, 4(%rsi)
  68. jne ..B1.7
  69. ..B1.4:
  70. cmpl $0, (%rsi)
  71. je ..B1.12
  72. ..B1.7:
  73. movsd %xmm2, -24(%rsp)
  74. ..B1.8:
  75. movzwl -18(%rsp), %eax
  76. andl $32752, %eax
  77. shrl $4, %eax
  78. cmpl $2047, %eax
  79. je ..B1.12
  80. ..B1.9:
  81. testl %eax, %eax
  82. jne ..B1.13
  83. ..B1.10:
  84. testl $1048575, -20(%rsp)
  85. jne ..B1.13
  86. ..B1.11:
  87. cmpl $0, -24(%rsp)
  88. jne ..B1.13
  89. ..B1.12:
  90. mulsd %xmm2, %xmm3
  91. movsd %xmm3, (%rcx)
  92. ret
  93. ..B1.13:
  94. testl %edx, %edx
  95. jne ..B1.15
  96. ..B1.14:
  97. lea _CONSTANTS(%rip), %rdx
  98. movaps %xmm3, %xmm1
  99. addl $-1023, %edi
  100. movsd (%rdx), %xmm0
  101. mulsd %xmm0, %xmm1
  102. mulsd %xmm0, %xmm7
  103. jmp ..B1.16
  104. ..B1.15:
  105. lea 32+_CONSTANTS(%rip), %rsi
  106. movl %edx, %r9d
  107. negl %r9d
  108. movaps %xmm3, %xmm1
  109. addl $-2, %r9d
  110. lea -1023(%rdi,%rdx), %edi
  111. andl $2047, %r9d
  112. movq (%rsi), %r8
  113. movq %r8, -24(%rsp)
  114. shrq $48, %r8
  115. shll $4, %r9d
  116. andl $-32753, %r8d
  117. orl %r9d, %r8d
  118. movw %r8w, -18(%rsp)
  119. movsd -24(%rsp), %xmm0
  120. mulsd %xmm0, %xmm1
  121. mulsd %xmm0, %xmm7
  122. ..B1.16:
  123. testl %eax, %eax
  124. jne ..B1.18
  125. ..B1.17:
  126. lea _CONSTANTS(%rip), %rax
  127. movaps %xmm2, %xmm8
  128. addl $-1023, %edi
  129. movsd (%rax), %xmm0
  130. mulsd %xmm0, %xmm8
  131. mulsd %xmm0, %xmm4
  132. jmp ..B1.19
  133. ..B1.18:
  134. lea 32+_CONSTANTS(%rip), %rdx
  135. movl %eax, %r8d
  136. negl %r8d
  137. movaps %xmm2, %xmm8
  138. addl $-2, %r8d
  139. lea -1023(%rdi,%rax), %edi
  140. andl $2047, %r8d
  141. movq (%rdx), %rsi
  142. movq %rsi, -24(%rsp)
  143. shrq $48, %rsi
  144. shll $4, %r8d
  145. andl $-32753, %esi
  146. orl %r8d, %esi
  147. movw %si, -18(%rsp)
  148. movsd -24(%rsp), %xmm0
  149. mulsd %xmm0, %xmm8
  150. mulsd %xmm0, %xmm4
  151. ..B1.19:
  152. movaps %xmm7, %xmm0
  153. lea 16+_CONSTANTS(%rip), %rax
  154. movaps %xmm4, %xmm10
  155. addsd %xmm1, %xmm0
  156. addsd %xmm8, %xmm10
  157. movaps %xmm0, %xmm5
  158. movaps %xmm0, %xmm9
  159. movaps %xmm10, %xmm11
  160. subsd %xmm1, %xmm5
  161. movsd (%rax), %xmm1
  162. subsd %xmm5, %xmm7
  163. mulsd %xmm1, %xmm9
  164. mulsd %xmm1, %xmm11
  165. movaps %xmm9, %xmm6
  166. subsd %xmm0, %xmm6
  167. subsd %xmm6, %xmm9
  168. movaps %xmm9, %xmm5
  169. subsd %xmm9, %xmm0
  170. addsd %xmm7, %xmm0
  171. movaps %xmm10, %xmm7
  172. subsd %xmm8, %xmm7
  173. movaps %xmm11, %xmm8
  174. movaps %xmm0, %xmm6
  175. subsd %xmm10, %xmm8
  176. subsd %xmm7, %xmm4
  177. subsd %xmm8, %xmm11
  178. mulsd %xmm11, %xmm0
  179. subsd %xmm11, %xmm10
  180. mulsd %xmm11, %xmm5
  181. addsd %xmm4, %xmm10
  182. mulsd %xmm10, %xmm6
  183. movaps %xmm5, %xmm4
  184. mulsd %xmm9, %xmm10
  185. addsd %xmm10, %xmm6
  186. addsd %xmm0, %xmm6
  187. addsd %xmm6, %xmm4
  188. movsd %xmm4, -16(%rsp)
  189. movzwl -10(%rsp), %edx
  190. movl %edx, %esi
  191. andl $32752, %esi
  192. shrl $4, %esi
  193. lea (%rdi,%rsi), %eax
  194. cmpl $2047, %eax
  195. jl ..B1.21
  196. ..B1.20:
  197. lea _CONSTANTS(%rip), %rax
  198. movsd (%rax), %xmm0
  199. mulsd %xmm0, %xmm0
  200. mulsd %xmm3, %xmm0
  201. mulsd %xmm2, %xmm0
  202. movsd %xmm0, (%rcx)
  203. ret
  204. ..B1.21:
  205. testl %eax, %eax
  206. jle ..B1.23
  207. ..B1.22:
  208. andl $2047, %eax
  209. andl $-32753, %edx
  210. shll $4, %eax
  211. orl %eax, %edx
  212. movw %dx, -10(%rsp)
  213. movq -16(%rsp), %rax
  214. movq %rax, (%rcx)
  215. ret
  216. ..B1.23:
  217. cmpl $-9, %eax
  218. jl ..B1.25
  219. ..B1.24:
  220. lea 8+_CONSTANTS(%rip), %rax
  221. lea 32+_CONSTANTS(%rip), %rsi
  222. lea 24+_CONSTANTS(%rip), %rdx
  223. addl $1423, %edi
  224. andl $2047, %edi
  225. shll $4, %edi
  226. movsd (%rax), %xmm0
  227. mulsd %xmm0, %xmm0
  228. movq (%rsi), %r8
  229. addsd %xmm0, %xmm5
  230. movaps %xmm5, %xmm4
  231. movq %r8, -24(%rsp)
  232. addsd %xmm6, %xmm4
  233. mulsd %xmm4, %xmm1
  234. movaps %xmm4, %xmm2
  235. subsd %xmm5, %xmm2
  236. movaps %xmm1, %xmm5
  237. subsd %xmm2, %xmm6
  238. subsd %xmm4, %xmm5
  239. shrq $48, %r8
  240. subsd %xmm5, %xmm1
  241. andl $-32753, %r8d
  242. subsd %xmm1, %xmm4
  243. orl %edi, %r8d
  244. addsd %xmm6, %xmm4
  245. movsd (%rdx), %xmm6
  246. mulsd %xmm6, %xmm1
  247. mulsd %xmm6, %xmm4
  248. movw %r8w, -18(%rsp)
  249. movsd -24(%rsp), %xmm3
  250. mulsd %xmm3, %xmm1
  251. mulsd %xmm3, %xmm4
  252. addsd %xmm4, %xmm1
  253. movsd %xmm1, (%rcx)
  254. ret
  255. ..B1.25:
  256. cmpl $-62, %eax
  257. jle ..B1.27
  258. ..B1.26:
  259. lea 32+_CONSTANTS(%rip), %rax
  260. lea 1022(%rdi,%rsi), %esi
  261. lea 8+_CONSTANTS(%rip), %rdi
  262. andl $-32753, %edx
  263. orl $16, %edx
  264. andl $2047, %esi
  265. movw %dx, -10(%rsp)
  266. movq (%rax), %rdx
  267. movsd (%rdi), %xmm0
  268. mulsd %xmm0, %xmm0
  269. movq %rdx, -24(%rsp)
  270. shrq $48, %rdx
  271. shll $4, %esi
  272. andl $-32753, %edx
  273. orl %esi, %edx
  274. movw %dx, -18(%rsp)
  275. movsd -16(%rsp), %xmm1
  276. addsd -24(%rsp), %xmm0
  277. mulsd %xmm0, %xmm1
  278. movsd %xmm0, -24(%rsp)
  279. movsd %xmm1, -16(%rsp)
  280. movsd %xmm1, (%rcx)
  281. ret
  282. ..B1.27:
  283. lea 8+_CONSTANTS(%rip), %rax
  284. movsd (%rax), %xmm0
  285. mulsd %xmm0, %xmm0
  286. mulsd %xmm3, %xmm0
  287. mulsd %xmm2, %xmm0
  288. movsd %xmm0, (%rcx)
  289. ..B1.28:
  290. ret
  291. .align 16,0x90
  292. .cfi_endproc
  293. .type __libm_mul_k64,@function
  294. .size __libm_mul_k64,.-__libm_mul_k64
  295. .data
  296. # -- End __libm_mul_k64
  297. .section .rodata, "a"
  298. .align 16
  299. .align 16
  300. _CONSTANTS:
  301. .long 0
  302. .long 2145386496
  303. .long 0
  304. .long 1048576
  305. .long 33554432
  306. .long 1101004800
  307. .long 0
  308. .long 653262848
  309. .long 0
  310. .long 1072693248
  311. .type _CONSTANTS,@object
  312. .size _CONSTANTS,40
  313. .data
  314. .section .note.GNU-stack, ""
  315. // -- Begin DWARF2 SEGMENT .eh_frame
  316. .section .eh_frame,"a",@progbits
  317. .eh_frame_seg:
  318. .align 1
  319. # End