log2l.S 13 KB

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