log2l.S 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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 "log2l.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin log2l
  41. .text
  42. .align 16,0x90
  43. .globl log2l
  44. log2l:
  45. # parameter 1: 8 + %ebp
  46. ..B1.1:
  47. ..L1:
  48. pushl %ebp
  49. movl %esp, %ebp
  50. andl $-16, %esp
  51. pushl %esi
  52. pushl %edi
  53. pushl %ebx
  54. subl $36, %esp
  55. ..B1.2:
  56. fnstcw 14(%esp)
  57. ..B1.3:
  58. movzbl 17(%ebp), %edi
  59. andl $128, %edi
  60. shrl $7, %edi
  61. movzwl 16(%ebp), %edx
  62. movl %edx, %eax
  63. movl %edi, %ebx
  64. andl $32767, %eax
  65. shll $15, %ebx
  66. movl 12(%ebp), %esi
  67. orl %eax, %ebx
  68. movl %esi, %ecx
  69. shll $16, %ebx
  70. shrl $16, %ecx
  71. orl %ecx, %ebx
  72. call ..L2
  73. ..L2:
  74. popl %ecx
  75. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx
  76. cmpl $2147450880, %ebx
  77. jae ..B1.29
  78. ..B1.4:
  79. addl $-1073676224, %ebx
  80. cmpl $32863, %ebx
  81. ja ..B1.13
  82. ..B1.5:
  83. cmpl $16383, %eax
  84. je ..B1.39
  85. ..B1.6:
  86. movzwl 14(%esp), %edx
  87. movl %edx, %eax
  88. andl $768, %eax
  89. cmpl $768, %eax
  90. je ..B1.38
  91. ..B1.7:
  92. orl $-64768, %edx
  93. movw %dx, 12(%esp)
  94. ..B1.8:
  95. fldcw 12(%esp)
  96. ..B1.9:
  97. movl $1, %eax
  98. ..B1.10:
  99. fldt 8(%ebp)
  100. testl %eax, %eax
  101. fldl _TWO_32H@GOTOFF(%ecx)
  102. fldt 84+_P@GOTOFF(%ecx)
  103. fldt 60+_P@GOTOFF(%ecx)
  104. fldt 36+_P@GOTOFF(%ecx)
  105. fxch %st(4)
  106. faddl 8+_ones@GOTOFF(%ecx)
  107. fld %st(0)
  108. fmul %st(1), %st
  109. fmul %st, %st(3)
  110. fxch %st(2)
  111. faddp %st, %st(3)
  112. fxch %st(1)
  113. fmul %st, %st(2)
  114. fxch %st(4)
  115. faddp %st, %st(2)
  116. fxch %st(1)
  117. fmul %st(3), %st
  118. fld %st(1)
  119. fxch %st(2)
  120. fmul %st, %st(3)
  121. fxch %st(2)
  122. fadd %st(3), %st
  123. fsubp %st, %st(3)
  124. fld %st(1)
  125. fsub %st(3), %st
  126. fxch %st(2)
  127. fstpt 8(%ebp)
  128. fldt 8(%ebp)
  129. fldt 12+_P@GOTOFF(%ecx)
  130. faddp %st, %st(2)
  131. fxch %st(1)
  132. fmul %st(4), %st
  133. fldt 72+_P@GOTOFF(%ecx)
  134. fmul %st(5), %st
  135. fldt 48+_P@GOTOFF(%ecx)
  136. faddp %st, %st(1)
  137. fmul %st(5), %st
  138. fldt 24+_P@GOTOFF(%ecx)
  139. faddp %st, %st(1)
  140. fmulp %st, %st(5)
  141. fldt _P@GOTOFF(%ecx)
  142. faddp %st, %st(5)
  143. fxch %st(1)
  144. fmulp %st, %st(4)
  145. faddp %st, %st(3)
  146. fldt 96+_P@GOTOFF(%ecx)
  147. fmul %st, %st(1)
  148. fxch %st(1)
  149. faddp %st, %st(3)
  150. fmulp %st, %st(1)
  151. faddp %st, %st(1)
  152. fstpt (%esp)
  153. je ..B1.12
  154. ..B1.11:
  155. fldcw 14(%esp)
  156. ..B1.12:
  157. fldt (%esp)
  158. addl $36, %esp
  159. popl %ebx
  160. popl %edi
  161. popl %esi
  162. movl %ebp, %esp
  163. popl %ebp
  164. ret
  165. ..B1.13:
  166. movzwl 14(%esp), %esi
  167. movl %esi, %ebx
  168. andl $768, %ebx
  169. cmpl $768, %ebx
  170. je ..B1.45
  171. ..B1.14:
  172. orl $-64768, %esi
  173. movw %si, 12(%esp)
  174. ..B1.15:
  175. fldcw 12(%esp)
  176. ..B1.16:
  177. movzwl 16(%ebp), %edx
  178. movl %edx, %eax
  179. movl $1, %esi
  180. andl $32767, %eax
  181. ..B1.17:
  182. testl %eax, %eax
  183. jne ..B1.20
  184. ..B1.18:
  185. fldt 8(%ebp)
  186. fmull _TWO_75@GOTOFF(%ecx)
  187. fstpt 8(%ebp)
  188. fldt 8(%ebp)
  189. fldl _zeros@GOTOFF(%ecx)
  190. fxch %st(1)
  191. fucomp %st(1)
  192. fnstsw %ax
  193. sahf
  194. jp ..B1.19
  195. je ..B1.42
  196. ..B1.19:
  197. fstp %st(0)
  198. movzwl 16(%ebp), %edx
  199. movl %edx, %eax
  200. movl $-16458, %ebx
  201. andl $32767, %eax
  202. jmp ..B1.21
  203. ..B1.20:
  204. movl $-16383, %ebx
  205. ..B1.21:
  206. movl 12(%ebp), %edi
  207. cmpl $-2147483648, %edi
  208. jne ..B1.26
  209. ..B1.22:
  210. cmpl $0, 8(%ebp)
  211. jne ..B1.26
  212. ..B1.23:
  213. addl %eax, %ebx
  214. movl %ebx, 16(%esp)
  215. testl %esi, %esi
  216. fildl 16(%esp)
  217. fstpt (%esp)
  218. je ..B1.25
  219. ..B1.24:
  220. fldcw 14(%esp)
  221. ..B1.25:
  222. fldt (%esp)
  223. addl $36, %esp
  224. popl %ebx
  225. popl %edi
  226. popl %esi
  227. movl %ebp, %esp
  228. popl %ebp
  229. ret
  230. ..B1.26:
  231. fldl _TWO_32H@GOTOFF(%ecx)
  232. andl $-32768, %edx
  233. fldt 84+_P@GOTOFF(%ecx)
  234. orl $-49153, %edx
  235. fldt 60+_P@GOTOFF(%ecx)
  236. addl %eax, %ebx
  237. movw %dx, 16(%ebp)
  238. fldt 8(%ebp)
  239. fld %st(0)
  240. shrl $23, %edi
  241. fadd %st(4), %st
  242. andl $255, %edi
  243. fsubp %st, %st(4)
  244. movl %ebx, 16(%esp)
  245. fsub %st(3), %st
  246. flds __libm_rcp_table_256@GOTOFF(%ecx,%edi,4)
  247. fmul %st, %st(4)
  248. fmulp %st, %st(1)
  249. fxch %st(3)
  250. faddl 8+_ones@GOTOFF(%ecx)
  251. fld %st(0)
  252. shll $4, %edi
  253. fadd %st(4), %st
  254. fld %st(0)
  255. testl %esi, %esi
  256. fmul %st(1), %st
  257. fmul %st, %st(4)
  258. fxch %st(3)
  259. faddp %st, %st(4)
  260. fxch %st(2)
  261. fmul %st, %st(3)
  262. fxch %st(2)
  263. fstpt 8(%ebp)
  264. fldt 8(%ebp)
  265. fldt 36+_P@GOTOFF(%ecx)
  266. faddp %st, %st(4)
  267. fxch %st(2)
  268. fmul %st, %st(3)
  269. fldt 12+_P@GOTOFF(%ecx)
  270. faddp %st, %st(4)
  271. fmul %st, %st(3)
  272. fldt 72+_P@GOTOFF(%ecx)
  273. fmul %st(1), %st
  274. fldt 48+_P@GOTOFF(%ecx)
  275. faddp %st, %st(1)
  276. fmul %st(1), %st
  277. fldt 24+_P@GOTOFF(%ecx)
  278. faddp %st, %st(1)
  279. fmulp %st, %st(1)
  280. fldt _P@GOTOFF(%ecx)
  281. faddp %st, %st(1)
  282. fmulp %st, %st(2)
  283. fxch %st(1)
  284. faddp %st, %st(2)
  285. fldt 96+_P@GOTOFF(%ecx)
  286. fmul %st, %st(3)
  287. fxch %st(3)
  288. faddp %st, %st(2)
  289. fmulp %st, %st(2)
  290. fildl 16(%esp)
  291. fxch %st(1)
  292. faddl 8+__libm_log2l_table_256@GOTOFF(%ecx,%edi)
  293. fxch %st(1)
  294. faddl __libm_log2l_table_256@GOTOFF(%edi,%ecx)
  295. fld %st(0)
  296. fadd %st(3), %st
  297. fsubr %st, %st(1)
  298. fxch %st(3)
  299. faddp %st, %st(1)
  300. faddp %st, %st(1)
  301. faddp %st, %st(1)
  302. fstpt (%esp)
  303. je ..B1.28
  304. ..B1.27:
  305. fldcw 14(%esp)
  306. ..B1.28:
  307. fldt (%esp)
  308. addl $36, %esp
  309. popl %ebx
  310. popl %edi
  311. popl %esi
  312. movl %ebp, %esp
  313. popl %ebp
  314. ret
  315. ..B1.29:
  316. movzwl 14(%esp), %edx
  317. movl %edx, %eax
  318. andl $768, %eax
  319. cmpl $768, %eax
  320. je ..B1.54
  321. ..B1.30:
  322. orl $-64768, %edx
  323. movw %dx, 12(%esp)
  324. ..B1.31:
  325. fldcw 12(%esp)
  326. ..B1.32:
  327. movzbl 17(%ebp), %edi
  328. movl $1, %edx
  329. andl $128, %edi
  330. shrl $7, %edi
  331. ..B1.33:
  332. testl %edi, %edi
  333. jne ..B1.46
  334. ..B1.34:
  335. fldt 8(%ebp)
  336. fmull _ones@GOTOFF(%ecx)
  337. fstpt (%esp)
  338. ..B1.35:
  339. testl %edx, %edx
  340. je ..B1.37
  341. ..B1.36:
  342. fldcw 14(%esp)
  343. ..B1.37:
  344. fldt (%esp)
  345. addl $36, %esp
  346. popl %ebx
  347. popl %edi
  348. popl %esi
  349. movl %ebp, %esp
  350. popl %ebp
  351. ret
  352. ..B1.38:
  353. xorl %eax, %eax
  354. jmp ..B1.10
  355. ..B1.39:
  356. cmpl $-2147483648, %esi
  357. jne ..B1.6
  358. ..B1.40:
  359. cmpl $0, 8(%ebp)
  360. jne ..B1.6
  361. ..B1.41:
  362. fldl _zeros@GOTOFF(%ecx)
  363. addl $36, %esp
  364. popl %ebx
  365. popl %edi
  366. popl %esi
  367. movl %ebp, %esp
  368. popl %ebp
  369. ret
  370. ..B1.42:
  371. fldl 8+_ones@GOTOFF(%ecx)
  372. testl %esi, %esi
  373. fdivp %st, %st(1)
  374. fstpl (%esp)
  375. je ..B1.44
  376. ..B1.43:
  377. fldcw 14(%esp)
  378. ..B1.44:
  379. fldl (%esp)
  380. addl $36, %esp
  381. popl %ebx
  382. popl %edi
  383. popl %esi
  384. movl %ebp, %esp
  385. popl %ebp
  386. ret
  387. ..B1.45:
  388. xorl %esi, %esi
  389. jmp ..B1.17
  390. ..B1.46:
  391. movzwl 16(%ebp), %eax
  392. andl $32767, %eax
  393. cmpl $32767, %eax
  394. jne ..B1.49
  395. ..B1.47:
  396. cmpl $-2147483648, 12(%ebp)
  397. jne ..B1.34
  398. ..B1.48:
  399. cmpl $0, 8(%ebp)
  400. jne ..B1.34
  401. jmp ..B1.53
  402. ..B1.49:
  403. testl %eax, %eax
  404. jne ..B1.53
  405. ..B1.50:
  406. cmpl $0, 12(%ebp)
  407. jne ..B1.53
  408. ..B1.51:
  409. cmpl $0, 8(%ebp)
  410. jne ..B1.53
  411. ..B1.52:
  412. fldl 8+_ones@GOTOFF(%ecx)
  413. fdivl _zeros@GOTOFF(%ecx)
  414. fstpt (%esp)
  415. jmp ..B1.35
  416. ..B1.53:
  417. fldl _infs@GOTOFF(%ecx)
  418. fmull _zeros@GOTOFF(%ecx)
  419. fstpt (%esp)
  420. jmp ..B1.35
  421. ..B1.54:
  422. xorl %edx, %edx
  423. jmp ..B1.33
  424. .align 16,0x90
  425. .type log2l,@function
  426. .size log2l,.-log2l
  427. .data
  428. # -- End log2l
  429. .section .rodata, "a"
  430. .align 4
  431. .align 4
  432. _TWO_32H:
  433. .long 0
  434. .long 1106771968
  435. .type _TWO_32H,@object
  436. .size _TWO_32H,8
  437. .align 4
  438. _ones:
  439. .long 0
  440. .long 1072693248
  441. .long 0
  442. .long 3220176896
  443. .type _ones,@object
  444. .size _ones,16
  445. .align 4
  446. _TWO_75:
  447. .long 0
  448. .long 1151336448
  449. .long 0
  450. .long 994050048
  451. .type _TWO_75,@object
  452. .size _TWO_75,16
  453. .align 4
  454. _zeros:
  455. .long 0
  456. .long 0
  457. .long 0
  458. .long 2147483648
  459. .type _zeros,@object
  460. .size _zeros,16
  461. .align 4
  462. _infs:
  463. .long 0
  464. .long 2146435072
  465. .long 0
  466. .long 4293918720
  467. .type _infs,@object
  468. .size _infs,16
  469. .align 2
  470. _P:
  471. .word 17354
  472. .word 24031
  473. .word 3064
  474. .word 38062
  475. .word 16360
  476. .word 0
  477. .word 61628
  478. .word 23575
  479. .word 15145
  480. .word 47274
  481. .word 49150
  482. .word 0
  483. .word 60493
  484. .word 53279
  485. .word 20193
  486. .word 63032
  487. .word 16381
  488. .word 0
  489. .word 62043
  490. .word 23575
  491. .word 15145
  492. .word 47274
  493. .word 49149
  494. .word 0
  495. .word 33329
  496. .word 29325
  497. .word 25223
  498. .word 37819
  499. .word 16381
  500. .word 0
  501. .word 5068
  502. .word 45194
  503. .word 20193
  504. .word 63032
  505. .word 49148
  506. .word 0
  507. .word 43239
  508. .word 63403
  509. .word 6517
  510. .word 54028
  511. .word 16380
  512. .word 0
  513. .word 25259
  514. .word 45714
  515. .word 45135
  516. .word 47274
  517. .word 49148
  518. .word 0
  519. .word 0
  520. .word 0
  521. .word 14848
  522. .word 47274
  523. .word 16383
  524. .word 0
  525. .type _P,@object
  526. .size _P,108
  527. .data
  528. .hidden __libm_rcp_table_256
  529. .hidden __libm_log2l_table_256
  530. .section .note.GNU-stack, ""
  531. # End