nearbyintl.S 15 KB

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