nearbyintl.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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 "nearbyintl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin nearbyintl
  41. .text
  42. .align 16,0x90
  43. .globl nearbyintl
  44. nearbyintl:
  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. movzwl 16(%ebp), %ebx
  59. andl $32767, %ebx
  60. movzwl 14(%esp), %edx
  61. cmpl $16446, %ebx
  62. call ..L2
  63. ..L2:
  64. popl %eax
  65. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
  66. jge ..B1.97
  67. ..B1.4:
  68. movl %edx, %esi
  69. andl $3072, %esi
  70. cmpl $1024, %esi
  71. je ..B1.78
  72. ..B1.5:
  73. cmpl $2048, %esi
  74. jne ..B1.25
  75. ..B1.6:
  76. cmpl $16383, %ebx
  77. jl ..B1.19
  78. ..B1.7:
  79. cmpl $16415, %ebx
  80. jl ..B1.9
  81. ..B1.8:
  82. negl %ebx
  83. movl $-1, %esi
  84. addl $30, %ebx
  85. movl %ebx, %ecx
  86. shll %cl, %esi
  87. movl 8(%ebp), %edi
  88. andl %edi, %esi
  89. movl %esi, 8(%ebp)
  90. xorl %edi, %esi
  91. jmp ..B1.10
  92. ..B1.9:
  93. negl %ebx
  94. movl $-1, %esi
  95. addl $30, %ebx
  96. movl %ebx, %ecx
  97. shll %cl, %esi
  98. movl 12(%ebp), %edi
  99. andl %edi, %esi
  100. movl %esi, 12(%ebp)
  101. xorl %edi, %esi
  102. orl 8(%ebp), %esi
  103. movl $0, 8(%ebp)
  104. ..B1.10:
  105. movzbl 17(%ebp), %ecx
  106. testl $128, %ecx
  107. jne ..B1.18
  108. ..B1.11:
  109. testl %esi, %esi
  110. je ..B1.18
  111. ..B1.12:
  112. movl %edx, %ecx
  113. andl $768, %ecx
  114. cmpl $768, %ecx
  115. je ..B1.103
  116. ..B1.13:
  117. orl $-64768, %edx
  118. movw %dx, 12(%esp)
  119. ..B1.14:
  120. fldcw 12(%esp)
  121. ..B1.15:
  122. fldt 8(%ebp)
  123. faddl _ones@GOTOFF(%eax)
  124. fstpt (%esp)
  125. ..B1.16:
  126. fldcw 14(%esp)
  127. ..B1.17:
  128. fldt (%esp)
  129. addl $36, %esp
  130. popl %ebx
  131. popl %edi
  132. popl %esi
  133. movl %ebp, %esp
  134. popl %ebp
  135. ret
  136. ..B1.18:
  137. fldt 8(%ebp)
  138. addl $36, %esp
  139. popl %ebx
  140. popl %edi
  141. popl %esi
  142. movl %ebp, %esp
  143. popl %ebp
  144. ret
  145. ..B1.19:
  146. testl %ebx, %ebx
  147. jne ..B1.24
  148. ..B1.20:
  149. cmpl $0, 12(%ebp)
  150. jne ..B1.23
  151. ..B1.21:
  152. cmpl $0, 8(%ebp)
  153. jne ..B1.23
  154. ..B1.22:
  155. fldt 8(%ebp)
  156. addl $36, %esp
  157. popl %ebx
  158. popl %edi
  159. popl %esi
  160. movl %ebp, %esp
  161. popl %ebp
  162. ret
  163. ..B1.23:
  164. fldl _smallest_value_64@GOTOFF(%eax)
  165. fstpl 16(%esp)
  166. ..B1.24:
  167. movzbl 17(%ebp), %edx
  168. andl $128, %edx
  169. shrl $7, %edx
  170. fldl _pone_nzero@GOTOFF(%eax,%edx,8)
  171. addl $36, %esp
  172. popl %ebx
  173. popl %edi
  174. popl %esi
  175. movl %ebp, %esp
  176. popl %ebp
  177. ret
  178. ..B1.25:
  179. cmpl $3072, %esi
  180. jne ..B1.36
  181. ..B1.26:
  182. cmpl $16383, %ebx
  183. jl ..B1.31
  184. ..B1.27:
  185. cmpl $16415, %ebx
  186. jl ..B1.29
  187. ..B1.28:
  188. negl %ebx
  189. movl $-1, %eax
  190. addl $30, %ebx
  191. movl %ebx, %ecx
  192. shll %cl, %eax
  193. andl 8(%ebp), %eax
  194. jmp ..B1.30
  195. ..B1.29:
  196. negl %ebx
  197. movl $-1, %eax
  198. addl $30, %ebx
  199. movl %ebx, %ecx
  200. shll %cl, %eax
  201. andl %eax, 12(%ebp)
  202. xorl %eax, %eax
  203. ..B1.30:
  204. movl %eax, 8(%ebp)
  205. fldt 8(%ebp)
  206. addl $36, %esp
  207. popl %ebx
  208. popl %edi
  209. popl %esi
  210. movl %ebp, %esp
  211. popl %ebp
  212. ret
  213. ..B1.31:
  214. testl %ebx, %ebx
  215. jne ..B1.35
  216. ..B1.32:
  217. cmpl $0, 12(%ebp)
  218. jne ..B1.34
  219. ..B1.33:
  220. cmpl $0, 8(%ebp)
  221. je ..B1.35
  222. ..B1.34:
  223. fldl _smallest_value_64@GOTOFF(%eax)
  224. fstpl 16(%esp)
  225. ..B1.35:
  226. movzbl 17(%ebp), %edx
  227. andl $128, %edx
  228. shrl $7, %edx
  229. fldl _zeros@GOTOFF(%eax,%edx,8)
  230. addl $36, %esp
  231. popl %ebx
  232. popl %edi
  233. popl %esi
  234. movl %ebp, %esp
  235. popl %ebp
  236. ret
  237. ..B1.36:
  238. cmpl $16383, %ebx
  239. jl ..B1.70
  240. ..B1.37:
  241. movl 8(%ebp), %edi
  242. cmpl $16414, %ebx
  243. jl ..B1.39
  244. ..B1.38:
  245. movl %edi, %esi
  246. lea 2(%ebx), %ecx
  247. shll %cl, %esi
  248. movl %esi, 4(%esp)
  249. movl $0, (%esp)
  250. jmp ..B1.40
  251. ..B1.39:
  252. movl 12(%ebp), %esi
  253. lea 2(%ebx), %ecx
  254. shll %cl, %esi
  255. movl %esi, 4(%esp)
  256. movl %edi, (%esp)
  257. ..B1.40:
  258. cmpl $16415, %ebx
  259. jl ..B1.42
  260. ..B1.41:
  261. movl %ebx, %ecx
  262. movl $-1, %esi
  263. negl %ecx
  264. addl $30, %ecx
  265. shll %cl, %esi
  266. andl %esi, %edi
  267. movl %edi, 8(%ebp)
  268. jmp ..B1.43
  269. ..B1.42:
  270. movl %ebx, %ecx
  271. movl $-1, %esi
  272. negl %ecx
  273. xorl %edi, %edi
  274. addl $30, %ecx
  275. shll %cl, %esi
  276. movl %edi, 8(%ebp)
  277. andl %esi, 12(%ebp)
  278. ..B1.43:
  279. cmpl $0, 4(%esp)
  280. jge ..B1.69
  281. ..B1.44:
  282. movl 4(%esp), %esi
  283. andl $2147483647, %esi
  284. orl (%esp), %esi
  285. je ..B1.52
  286. ..B1.45:
  287. movl %edx, %ecx
  288. andl $768, %ecx
  289. cmpl $768, %ecx
  290. je ..B1.104
  291. ..B1.46:
  292. orl $-64768, %edx
  293. movw %dx, 12(%esp)
  294. ..B1.47:
  295. fldcw 12(%esp)
  296. ..B1.48:
  297. movl $1, %ecx
  298. ..B1.49:
  299. fldt 8(%ebp)
  300. movzbl 17(%ebp), %edx
  301. andl $128, %edx
  302. shrl $7, %edx
  303. testl %ecx, %ecx
  304. faddl _ones@GOTOFF(%eax,%edx,8)
  305. fstpt (%esp)
  306. je ..B1.51
  307. ..B1.50:
  308. fldcw 14(%esp)
  309. ..B1.51:
  310. fldt (%esp)
  311. addl $36, %esp
  312. popl %ebx
  313. popl %edi
  314. popl %esi
  315. movl %ebp, %esp
  316. popl %ebp
  317. ret
  318. ..B1.52:
  319. cmpl $16415, %ebx
  320. jl ..B1.61
  321. ..B1.53:
  322. negl %ebx
  323. movl $1, %esi
  324. addl $30, %ebx
  325. movl %ebx, %ecx
  326. shll %cl, %esi
  327. testl %esi, %edi
  328. je ..B1.69
  329. ..B1.54:
  330. movl %edx, %ecx
  331. andl $768, %ecx
  332. cmpl $768, %ecx
  333. je ..B1.105
  334. ..B1.55:
  335. orl $-64768, %edx
  336. movw %dx, 12(%esp)
  337. ..B1.56:
  338. fldcw 12(%esp)
  339. ..B1.57:
  340. movl $1, %ecx
  341. ..B1.58:
  342. fldt 8(%ebp)
  343. movzbl 17(%ebp), %edx
  344. andl $128, %edx
  345. shrl $7, %edx
  346. testl %ecx, %ecx
  347. faddl _ones@GOTOFF(%eax,%edx,8)
  348. fstpt (%esp)
  349. je ..B1.60
  350. ..B1.59:
  351. fldcw 14(%esp)
  352. ..B1.60:
  353. fldt (%esp)
  354. addl $36, %esp
  355. popl %ebx
  356. popl %edi
  357. popl %esi
  358. movl %ebp, %esp
  359. popl %ebp
  360. ret
  361. ..B1.61:
  362. negl %ebx
  363. movl $1, %esi
  364. addl $30, %ebx
  365. movl %ebx, %ecx
  366. shll %cl, %esi
  367. testl %esi, 12(%ebp)
  368. je ..B1.69
  369. ..B1.62:
  370. movl %edx, %ecx
  371. andl $768, %ecx
  372. cmpl $768, %ecx
  373. je ..B1.106
  374. ..B1.63:
  375. orl $-64768, %edx
  376. movw %dx, 12(%esp)
  377. ..B1.64:
  378. fldcw 12(%esp)
  379. ..B1.65:
  380. movl $1, %ecx
  381. ..B1.66:
  382. fldt 8(%ebp)
  383. movzbl 17(%ebp), %edx
  384. andl $128, %edx
  385. shrl $7, %edx
  386. testl %ecx, %ecx
  387. faddl _ones@GOTOFF(%eax,%edx,8)
  388. fstpt (%esp)
  389. je ..B1.68
  390. ..B1.67:
  391. fldcw 14(%esp)
  392. ..B1.68:
  393. fldt (%esp)
  394. addl $36, %esp
  395. popl %ebx
  396. popl %edi
  397. popl %esi
  398. movl %ebp, %esp
  399. popl %ebp
  400. ret
  401. ..B1.69:
  402. fldt 8(%ebp)
  403. addl $36, %esp
  404. popl %ebx
  405. popl %edi
  406. popl %esi
  407. movl %ebp, %esp
  408. popl %ebp
  409. ret
  410. ..B1.70:
  411. cmpl $16382, %ebx
  412. jle ..B1.72
  413. ..B1.71:
  414. movzbl 17(%ebp), %edx
  415. andl $128, %edx
  416. shrl $7, %edx
  417. fldl _ones@GOTOFF(%eax,%edx,8)
  418. addl $36, %esp
  419. popl %ebx
  420. popl %edi
  421. popl %esi
  422. movl %ebp, %esp
  423. popl %ebp
  424. ret
  425. ..B1.72:
  426. je ..B1.107
  427. ..B1.73:
  428. testl %ebx, %ebx
  429. jne ..B1.77
  430. ..B1.74:
  431. cmpl $0, 12(%ebp)
  432. jne ..B1.76
  433. ..B1.75:
  434. cmpl $0, 8(%ebp)
  435. je ..B1.77
  436. ..B1.76:
  437. fldl _smallest_value_64@GOTOFF(%eax)
  438. fstpl 16(%esp)
  439. ..B1.77:
  440. movzbl 17(%ebp), %edx
  441. andl $128, %edx
  442. shrl $7, %edx
  443. fldl _zeros@GOTOFF(%eax,%edx,8)
  444. addl $36, %esp
  445. popl %ebx
  446. popl %edi
  447. popl %esi
  448. movl %ebp, %esp
  449. popl %ebp
  450. ret
  451. ..B1.78:
  452. cmpl $16383, %ebx
  453. jl ..B1.91
  454. ..B1.79:
  455. cmpl $16415, %ebx
  456. jl ..B1.81
  457. ..B1.80:
  458. negl %ebx
  459. movl $-1, %edi
  460. addl $30, %ebx
  461. movl %ebx, %ecx
  462. shll %cl, %edi
  463. movl 8(%ebp), %esi
  464. andl %esi, %edi
  465. movl %edi, 8(%ebp)
  466. xorl %edi, %esi
  467. jmp ..B1.82
  468. ..B1.81:
  469. negl %ebx
  470. movl $-1, %edi
  471. addl $30, %ebx
  472. movl %ebx, %ecx
  473. shll %cl, %edi
  474. movl 12(%ebp), %esi
  475. andl %esi, %edi
  476. xorl %edi, %esi
  477. orl 8(%ebp), %esi
  478. movl %edi, 12(%ebp)
  479. movl $0, 8(%ebp)
  480. ..B1.82:
  481. movzbl 17(%ebp), %ecx
  482. testl $128, %ecx
  483. je ..B1.90
  484. ..B1.83:
  485. testl %esi, %esi
  486. je ..B1.90
  487. ..B1.84:
  488. movl %edx, %ecx
  489. andl $768, %ecx
  490. cmpl $768, %ecx
  491. je ..B1.110
  492. ..B1.85:
  493. orl $-64768, %edx
  494. movw %dx, 12(%esp)
  495. ..B1.86:
  496. fldcw 12(%esp)
  497. ..B1.87:
  498. fldt 8(%ebp)
  499. faddl 8+_ones@GOTOFF(%eax)
  500. fstpt (%esp)
  501. ..B1.88:
  502. fldcw 14(%esp)
  503. ..B1.89:
  504. fldt (%esp)
  505. addl $36, %esp
  506. popl %ebx
  507. popl %edi
  508. popl %esi
  509. movl %ebp, %esp
  510. popl %ebp
  511. ret
  512. ..B1.90:
  513. fldt 8(%ebp)
  514. addl $36, %esp
  515. popl %ebx
  516. popl %edi
  517. popl %esi
  518. movl %ebp, %esp
  519. popl %ebp
  520. ret
  521. ..B1.91:
  522. testl %ebx, %ebx
  523. jne ..B1.96
  524. ..B1.92:
  525. cmpl $0, 12(%ebp)
  526. jne ..B1.95
  527. ..B1.93:
  528. cmpl $0, 8(%ebp)
  529. jne ..B1.95
  530. ..B1.94:
  531. fldt 8(%ebp)
  532. addl $36, %esp
  533. popl %ebx
  534. popl %edi
  535. popl %esi
  536. movl %ebp, %esp
  537. popl %ebp
  538. ret
  539. ..B1.95:
  540. fldl _smallest_value_64@GOTOFF(%eax)
  541. fstpl 16(%esp)
  542. ..B1.96:
  543. movzbl 17(%ebp), %edx
  544. andl $128, %edx
  545. shrl $7, %edx
  546. fldl _pzero_none@GOTOFF(%eax,%edx,8)
  547. addl $36, %esp
  548. popl %ebx
  549. popl %edi
  550. popl %esi
  551. movl %ebp, %esp
  552. popl %ebp
  553. ret
  554. ..B1.97:
  555. movl %edx, %ecx
  556. andl $768, %ecx
  557. cmpl $768, %ecx
  558. je ..B1.111
  559. ..B1.98:
  560. orl $-64768, %edx
  561. movw %dx, 12(%esp)
  562. ..B1.99:
  563. fldcw 12(%esp)
  564. ..B1.100:
  565. fldt 8(%ebp)
  566. fmull _ones@GOTOFF(%eax)
  567. fstpt (%esp)
  568. ..B1.101:
  569. fldcw 14(%esp)
  570. ..B1.102:
  571. fldt (%esp)
  572. addl $36, %esp
  573. popl %ebx
  574. popl %edi
  575. popl %esi
  576. movl %ebp, %esp
  577. popl %ebp
  578. ret
  579. ..B1.103:
  580. fldt 8(%ebp)
  581. faddl _ones@GOTOFF(%eax)
  582. fstpt (%esp)
  583. jmp ..B1.17
  584. ..B1.104:
  585. xorl %ecx, %ecx
  586. jmp ..B1.49
  587. ..B1.105:
  588. xorl %ecx, %ecx
  589. jmp ..B1.58
  590. ..B1.106:
  591. xorl %ecx, %ecx
  592. jmp ..B1.66
  593. ..B1.107:
  594. movl 12(%ebp), %edx
  595. cmpl $-2147483648, %edx
  596. ja ..B1.71
  597. ..B1.108:
  598. jne ..B1.77
  599. ..B1.109:
  600. cmpl $0, 8(%ebp)
  601. ja ..B1.71
  602. jmp ..B1.77
  603. ..B1.110:
  604. fldt 8(%ebp)
  605. faddl 8+_ones@GOTOFF(%eax)
  606. fstpt (%esp)
  607. jmp ..B1.89
  608. ..B1.111:
  609. fldt 8(%ebp)
  610. fmull _ones@GOTOFF(%eax)
  611. fstpt (%esp)
  612. jmp ..B1.102
  613. .align 16,0x90
  614. .type nearbyintl,@function
  615. .size nearbyintl,.-nearbyintl
  616. .data
  617. # -- End nearbyintl
  618. .section .rodata, "a"
  619. .align 4
  620. .align 4
  621. _ones:
  622. .long 0
  623. .long 1072693248
  624. .long 0
  625. .long 3220176896
  626. .type _ones,@object
  627. .size _ones,16
  628. .align 4
  629. _smallest_value_64:
  630. .long 1
  631. .long 0
  632. .long 1
  633. .long 2147483648
  634. .type _smallest_value_64,@object
  635. .size _smallest_value_64,16
  636. .align 4
  637. _pone_nzero:
  638. .long 0
  639. .long 1072693248
  640. .long 0
  641. .long 2147483648
  642. .type _pone_nzero,@object
  643. .size _pone_nzero,16
  644. .align 4
  645. _zeros:
  646. .long 0
  647. .long 0
  648. .long 0
  649. .long 2147483648
  650. .type _zeros,@object
  651. .size _zeros,16
  652. .align 4
  653. _pzero_none:
  654. .long 0
  655. .long 0
  656. .long 0
  657. .long 3220176896
  658. .type _pzero_none,@object
  659. .size _pzero_none,16
  660. .data
  661. .section .note.GNU-stack, ""
  662. # End