libm_exp_k64.S 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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_exp_k64.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin __libm_exp_k64
  41. .text
  42. .align 16,0x90
  43. .globl __libm_exp_k64
  44. __libm_exp_k64:
  45. # parameter 1: %xmm0
  46. # parameter 2: %rdi
  47. # parameter 3: %rsi
  48. ..B1.1:
  49. .cfi_startproc
  50. ..___tag_value___libm_exp_k64.1:
  51. ..L2:
  52. movsd %xmm0, -8(%rsp)
  53. movzwl -2(%rsp), %eax
  54. andl $32752, %eax
  55. movb -1(%rsp), %dl
  56. andb $-128, %dl
  57. shrl $4, %eax
  58. shrb $7, %dl
  59. cmpl $2047, %eax
  60. je ..B1.10
  61. ..B1.2:
  62. cmpl $966, %eax
  63. jge ..B1.6
  64. ..B1.3:
  65. movl $0, (%rdi)
  66. cmpl $917, %eax
  67. jge ..B1.5
  68. ..B1.4:
  69. movq $0x3ff0000000000000, %rax
  70. movq %rax, (%rsi)
  71. movq $0, 8(%rsi)
  72. ret
  73. ..B1.5:
  74. movsd .L_2il0floatpacket.9(%rip), %xmm0
  75. movsd -8(%rsp), %xmm2
  76. movaps %xmm0, %xmm1
  77. addsd %xmm2, %xmm1
  78. movsd %xmm1, (%rsi)
  79. subsd %xmm0, %xmm1
  80. movsd %xmm1, -24(%rsp)
  81. subsd %xmm1, %xmm2
  82. movsd %xmm2, 8(%rsi)
  83. ret
  84. ..B1.6:
  85. cmpl $1035, %eax
  86. jge ..B1.8
  87. ..B1.7:
  88. movsd -8(%rsp), %xmm0
  89. lea _TWO_52H(%rip), %rax
  90. movsd .L_2il0floatpacket.0(%rip), %xmm4
  91. movsd .L_2il0floatpacket.1(%rip), %xmm2
  92. movsd .L_2il0floatpacket.2(%rip), %xmm3
  93. mulsd %xmm0, %xmm4
  94. movsd (%rax), %xmm1
  95. movsd .L_2il0floatpacket.4(%rip), %xmm12
  96. addsd %xmm1, %xmm4
  97. movsd %xmm4, -24(%rsp)
  98. subsd %xmm1, %xmm4
  99. mulsd %xmm4, %xmm2
  100. mulsd %xmm3, %xmm4
  101. subsd %xmm2, %xmm0
  102. movaps %xmm0, %xmm7
  103. movsd %xmm0, -8(%rsp)
  104. subsd %xmm4, %xmm7
  105. movaps %xmm7, %xmm8
  106. subsd %xmm7, %xmm0
  107. movsd .L_2il0floatpacket.6(%rip), %xmm9
  108. subsd %xmm4, %xmm0
  109. movsd .L_2il0floatpacket.9(%rip), %xmm5
  110. addsd %xmm0, %xmm8
  111. addsd %xmm7, %xmm5
  112. movaps %xmm8, %xmm10
  113. mulsd %xmm8, %xmm10
  114. mulsd %xmm10, %xmm12
  115. mulsd %xmm10, %xmm9
  116. addsd .L_2il0floatpacket.5(%rip), %xmm12
  117. addsd .L_2il0floatpacket.7(%rip), %xmm9
  118. mulsd %xmm10, %xmm12
  119. mulsd %xmm8, %xmm9
  120. movsd %xmm5, -16(%rsp)
  121. addsd %xmm9, %xmm12
  122. movl $0, -16(%rsp)
  123. movsd -16(%rsp), %xmm14
  124. movsd .L_2il0floatpacket.3(%rip), %xmm6
  125. movsd .L_2il0floatpacket.8(%rip), %xmm11
  126. addsd %xmm14, %xmm6
  127. mulsd %xmm10, %xmm12
  128. mulsd %xmm10, %xmm11
  129. subsd %xmm6, %xmm7
  130. addsd %xmm11, %xmm12
  131. addsd %xmm7, %xmm0
  132. movl -24(%rsp), %r8d
  133. movl %r8d, %edx
  134. shll $25, %edx
  135. addsd %xmm12, %xmm0
  136. sarl $25, %edx
  137. subl %edx, %r8d
  138. movslq %edx, %rdx
  139. shlq $4, %rdx
  140. movq __libm_exp_table_128@GOTPCREL(%rip), %rcx
  141. sarl $7, %r8d
  142. movsd 1032(%rcx,%rdx), %xmm1
  143. movaps %xmm1, %xmm13
  144. mulsd %xmm0, %xmm1
  145. addsd %xmm14, %xmm0
  146. mulsd %xmm14, %xmm13
  147. movsd 1024(%rcx,%rdx), %xmm15
  148. mulsd %xmm0, %xmm15
  149. movl %r8d, (%rdi)
  150. addsd %xmm15, %xmm1
  151. movsd %xmm13, (%rsi)
  152. movsd %xmm1, 8(%rsi)
  153. ret
  154. ..B1.8:
  155. movzbl %dl, %edx
  156. lea _inf_zeros(%rip), %rax
  157. movl $0, (%rdi)
  158. movq $0, 8(%rsi)
  159. movq (%rax,%rdx,8), %rcx
  160. movq %rcx, (%rsi)
  161. ..B1.9:
  162. ret
  163. ..B1.10:
  164. testl $1048575, -4(%rsp)
  165. jne ..B1.13
  166. ..B1.11:
  167. cmpl $0, -8(%rsp)
  168. jne ..B1.13
  169. ..B1.12:
  170. movzbl %dl, %edx
  171. lea _inf_zeros(%rip), %rax
  172. movsd (%rax,%rdx,8), %xmm0
  173. jmp ..B1.14
  174. ..B1.13:
  175. movsd -8(%rsp), %xmm0
  176. ..B1.14:
  177. movl $0, (%rdi)
  178. movsd %xmm0, (%rsi)
  179. movq $0, 8(%rsi)
  180. ret
  181. .align 16,0x90
  182. .cfi_endproc
  183. .type __libm_exp_k64,@function
  184. .size __libm_exp_k64,.-__libm_exp_k64
  185. .data
  186. # -- End __libm_exp_k64
  187. .section .rodata, "a"
  188. .align 8
  189. .align 8
  190. .L_2il0floatpacket.0:
  191. .long 0x652b82fe,0x40671547
  192. .type .L_2il0floatpacket.0,@object
  193. .size .L_2il0floatpacket.0,8
  194. .align 8
  195. .L_2il0floatpacket.1:
  196. .long 0x00000000,0x3f762e42
  197. .type .L_2il0floatpacket.1,@object
  198. .size .L_2il0floatpacket.1,8
  199. .align 8
  200. .L_2il0floatpacket.2:
  201. .long 0x3de6af28,0x3e2fdf47
  202. .type .L_2il0floatpacket.2,@object
  203. .size .L_2il0floatpacket.2,8
  204. .align 8
  205. .L_2il0floatpacket.3:
  206. .long 0x00000000,0xbff00000
  207. .type .L_2il0floatpacket.3,@object
  208. .size .L_2il0floatpacket.3,8
  209. .align 8
  210. .L_2il0floatpacket.4:
  211. .long 0x87372663,0x3f56c16c
  212. .type .L_2il0floatpacket.4,@object
  213. .size .L_2il0floatpacket.4,8
  214. .align 8
  215. .L_2il0floatpacket.5:
  216. .long 0x5555541d,0x3fa55555
  217. .type .L_2il0floatpacket.5,@object
  218. .size .L_2il0floatpacket.5,8
  219. .align 8
  220. .L_2il0floatpacket.6:
  221. .long 0x6887cd7c,0x3f811111
  222. .type .L_2il0floatpacket.6,@object
  223. .size .L_2il0floatpacket.6,8
  224. .align 8
  225. .L_2il0floatpacket.7:
  226. .long 0x55555405,0x3fc55555
  227. .type .L_2il0floatpacket.7,@object
  228. .size .L_2il0floatpacket.7,8
  229. .align 8
  230. .L_2il0floatpacket.8:
  231. .long 0x00000000,0x3fe00000
  232. .type .L_2il0floatpacket.8,@object
  233. .size .L_2il0floatpacket.8,8
  234. .align 8
  235. .L_2il0floatpacket.9:
  236. .long 0x00000000,0x3ff00000
  237. .type .L_2il0floatpacket.9,@object
  238. .size .L_2il0floatpacket.9,8
  239. .align 4
  240. _TWO_52H:
  241. .long 0
  242. .long 1127743488
  243. .type _TWO_52H,@object
  244. .size _TWO_52H,8
  245. .align 4
  246. _inf_zeros:
  247. .long 0
  248. .long 2146435072
  249. .long 0
  250. .long 0
  251. .type _inf_zeros,@object
  252. .size _inf_zeros,16
  253. .data
  254. .section .note.GNU-stack, ""
  255. // -- Begin DWARF2 SEGMENT .eh_frame
  256. .section .eh_frame,"a",@progbits
  257. .eh_frame_seg:
  258. .align 1
  259. # End