libm_sincos_k32.S 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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_sincos_k32.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin __libm_sincos_k32
  41. .text
  42. .align 16,0x90
  43. .hidden __libm_sincos_k32
  44. .globl __libm_sincos_k32
  45. __libm_sincos_k32:
  46. # parameter 1: 8 + %ebp
  47. # parameter 2: 16 + %ebp
  48. # parameter 3: 20 + %ebp
  49. # parameter 4: 24 + %ebp
  50. ..B1.1:
  51. ..L1:
  52. pushl %ebp
  53. movl %esp, %ebp
  54. andl $-64, %esp
  55. pushl %esi
  56. pushl %edi
  57. pushl %ebx
  58. subl $52, %esp
  59. fldl 8(%ebp)
  60. movl 12(%ebp), %edi
  61. movl %edi, %edx
  62. call ..L2
  63. ..L2:
  64. popl %esi
  65. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi
  66. andl $2147483647, %edx
  67. fabs
  68. shrl $31, %edi
  69. movl 24(%ebp), %ecx
  70. movl 16(%ebp), %eax
  71. movl 20(%ebp), %ebx
  72. imull iones@GOTOFF(%esi,%edi,4), %ecx
  73. movl %eax, 36(%esp)
  74. cmpl $1103101952, %edx
  75. jae ..B1.9
  76. ..B1.2:
  77. cmpl $1073283072, %edx
  78. ja ..B1.6
  79. ..B1.3:
  80. incl %ecx
  81. movl %ecx, %edx
  82. andl $2, %edx
  83. je ..B1.5
  84. ..B1.4:
  85. fsubl .L_2il0floatpacket.0@GOTOFF(%esi)
  86. fstl 8(%ebp)
  87. jmp ..B1.11
  88. ..B1.5:
  89. fstl 8(%ebp)
  90. jmp ..B1.11
  91. ..B1.6:
  92. fldl _INV_PI04@GOTOFF(%esi)
  93. fmul %st(1), %st
  94. movl %edi, 32(%esp)
  95. fxch %st(1)
  96. fstl 8(%ebp)
  97. fldl _TWO_52H@GOTOFF(%esi)
  98. fadd %st(2), %st
  99. fstpl 16(%esp)
  100. fildl 16(%esp)
  101. movl 16(%esp), %edi
  102. fcomp %st(2)
  103. fnstsw %ax
  104. fxch %st(1)
  105. fstp %st(0)
  106. sahf
  107. movl $1, %eax
  108. ja ..L3
  109. movl $0, %eax
  110. ..L3:
  111. subl %eax, %edi
  112. addl %edi, %ecx
  113. movl %ecx, %eax
  114. andl $1, %eax
  115. addl %eax, %edi
  116. addl %eax, %ecx
  117. movl %edi, 24(%esp)
  118. cmpl $1090519040, %edx
  119. fildl 24(%esp)
  120. movl 32(%esp), %edi
  121. jae ..B1.8
  122. ..B1.7:
  123. fldl _DP2@GOTOFF(%esi)
  124. movl %ecx, %edx
  125. fmul %st(1), %st
  126. andl $2, %edx
  127. fsubrp %st, %st(2)
  128. fldl 8+_DP2@GOTOFF(%esi)
  129. fmul %st(1), %st
  130. fsubrp %st, %st(2)
  131. fldl 16+_DP2@GOTOFF(%esi)
  132. fmulp %st, %st(1)
  133. fsubrp %st, %st(1)
  134. fstl 8(%ebp)
  135. jmp ..B1.11
  136. ..B1.8:
  137. fstp %st(1)
  138. fldl _DP3@GOTOFF(%esi)
  139. movl %ecx, %edx
  140. fmul %st(1), %st
  141. andl $2, %edx
  142. fldl 8+_DP3@GOTOFF(%esi)
  143. fmul %st(2), %st
  144. fxch %st(1)
  145. fsubrl 8(%ebp)
  146. fsubp %st, %st(1)
  147. fldl 16+_DP3@GOTOFF(%esi)
  148. fmul %st(2), %st
  149. fsubrp %st, %st(1)
  150. fldl 24+_DP3@GOTOFF(%esi)
  151. fmulp %st, %st(2)
  152. fsubp %st, %st(1)
  153. fstl 8(%ebp)
  154. jmp ..B1.11
  155. ..B1.9:
  156. fstl (%esp)
  157. lea 8(%ebp), %eax
  158. movl %eax, 8(%esp)
  159. fstpl (%eax)
  160. movl %ecx, 12(%esp)
  161. call __libm_reduce_pi04d
  162. ..B1.17:
  163. movl %eax, %ecx
  164. ..B1.10:
  165. fldl 8(%ebp)
  166. incl %ecx
  167. movl %ecx, %edx
  168. andl $2, %edx
  169. ..B1.11:
  170. fldl 24+_CP@GOTOFF(%esi)
  171. fld %st(1)
  172. fmul %st(2), %st
  173. lea 2(%ecx), %eax
  174. fld %st(0)
  175. fmul %st(1), %st
  176. fmul %st, %st(2)
  177. fld1
  178. fxch %st(3)
  179. faddl 8+_CP@GOTOFF(%esi)
  180. fmul %st(1), %st
  181. shrl $2, %ecx
  182. faddp %st, %st(3)
  183. fldl 32+_CP@GOTOFF(%esi)
  184. andl $1, %ecx
  185. fmul %st(1), %st
  186. xorl %ecx, %edi
  187. fldl 24+_SP@GOTOFF(%esi)
  188. fmul %st(2), %st
  189. fxch %st(1)
  190. faddl 16+_CP@GOTOFF(%esi)
  191. fmul %st(2), %st
  192. fxch %st(1)
  193. faddl 8+_SP@GOTOFF(%esi)
  194. fmul %st(2), %st
  195. fmul %st(5), %st
  196. shrl $2, %eax
  197. fadd %st(5), %st
  198. fxch %st(1)
  199. faddl _CP@GOTOFF(%esi)
  200. fmul %st(3), %st
  201. andl $1, %eax
  202. testl %edx, %edx
  203. faddp %st, %st(4)
  204. fldl 32+_SP@GOTOFF(%esi)
  205. fmul %st(2), %st
  206. faddl 16+_SP@GOTOFF(%esi)
  207. fmulp %st, %st(2)
  208. fxch %st(1)
  209. faddl _SP@GOTOFF(%esi)
  210. fmulp %st, %st(2)
  211. fxch %st(3)
  212. fmulp %st, %st(1)
  213. faddp %st, %st(2)
  214. fldl ones@GOTOFF(%esi,%edi,8)
  215. je ..B1.13
  216. ..B1.12:
  217. fxch %st(2)
  218. fmull ones@GOTOFF(%esi,%eax,8)
  219. fxch %st(2)
  220. fmulp %st, %st(1)
  221. movl 36(%esp), %edx
  222. fstpl (%edx)
  223. fstpl (%ebx)
  224. addl $52, %esp
  225. popl %ebx
  226. popl %edi
  227. popl %esi
  228. movl %ebp, %esp
  229. popl %ebp
  230. ret
  231. ..B1.13:
  232. fxch %st(1)
  233. fmull ones@GOTOFF(%esi,%eax,8)
  234. fxch %st(2)
  235. fmulp %st, %st(1)
  236. movl 36(%esp), %edx
  237. fstpl (%edx)
  238. fstpl (%ebx)
  239. ..B1.14:
  240. addl $52, %esp
  241. popl %ebx
  242. popl %edi
  243. popl %esi
  244. movl %ebp, %esp
  245. popl %ebp
  246. ret
  247. .align 16,0x90
  248. .type __libm_sincos_k32,@function
  249. .size __libm_sincos_k32,.-__libm_sincos_k32
  250. .data
  251. # -- End __libm_sincos_k32
  252. .section .rodata, "a"
  253. .align 8
  254. .align 8
  255. .L_2il0floatpacket.0:
  256. .long 0x54442d18,0x3fe921fb
  257. .type .L_2il0floatpacket.0,@object
  258. .size .L_2il0floatpacket.0,8
  259. .align 8
  260. ones:
  261. .long 0x00000000,0x3ff00000
  262. .long 0x00000000,0xbff00000
  263. .type ones,@object
  264. .size ones,16
  265. .align 4
  266. iones:
  267. .long 1
  268. .long -1
  269. .type iones,@object
  270. .size iones,8
  271. .align 4
  272. _INV_PI04:
  273. .long 1841940611
  274. .long 1072979760
  275. .type _INV_PI04,@object
  276. .size _INV_PI04,8
  277. .align 4
  278. _TWO_52H:
  279. .long 0
  280. .long 1127743488
  281. .type _TWO_52H,@object
  282. .size _TWO_52H,8
  283. .align 4
  284. _DP2:
  285. .long 1413742592
  286. .long 1072243195
  287. .long 1279262720
  288. .long 1031179299
  289. .long 1880851354
  290. .long 996723793
  291. .type _DP2,@object
  292. .size _DP2,24
  293. .align 4
  294. _DP3:
  295. .long 1073741824
  296. .long 1072243195
  297. .long 0
  298. .long 1046758445
  299. .long 2147483648
  300. .long 1021855384
  301. .long 1880851354
  302. .long 996723793
  303. .type _DP3,@object
  304. .size _DP3,32
  305. .align 4
  306. _CP:
  307. .long 4294960802
  308. .long 3219128319
  309. .long 1427442001
  310. .long 1067799893
  311. .long 2926645240
  312. .long 3210133867
  313. .long 2571283200
  314. .long 1056571689
  315. .long 2069816734
  316. .long 3197257552
  317. .type _CP,@object
  318. .size _CP,40
  319. .align 4
  320. _SP:
  321. .long 1431654765
  322. .long 3217380693
  323. .long 285032968
  324. .long 1065423121
  325. .long 3653044354
  326. .long 3207201183
  327. .long 2777006020
  328. .long 1053236634
  329. .long 43514947
  330. .long 3193610888
  331. .type _SP,@object
  332. .size _SP,40
  333. .data
  334. .hidden __libm_reduce_pi04d
  335. .section .note.GNU-stack, ""
  336. # End