llroundl.S 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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 "llroundl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin llroundl
  41. .text
  42. .align 16,0x90
  43. .globl llroundl
  44. llroundl:
  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. movzbl 17(%ebp), %ebx
  56. movzwl 16(%ebp), %eax
  57. andl $128, %ebx
  58. andl $32767, %eax
  59. shrl $7, %ebx
  60. call ..L2
  61. ..L2:
  62. popl %edi
  63. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi
  64. cmpl $16445, %eax
  65. jge ..B1.17
  66. ..B1.2:
  67. cmpl $16415, %eax
  68. jge ..B1.16
  69. ..B1.3:
  70. cmpl $16414, %eax
  71. jge ..B1.15
  72. ..B1.4:
  73. cmpl $16413, %eax
  74. jge ..B1.14
  75. ..B1.5:
  76. cmpl $16383, %eax
  77. jge ..B1.13
  78. ..B1.6:
  79. cmpl $16382, %eax
  80. jge ..B1.12
  81. ..B1.7:
  82. testl %eax, %eax
  83. jne ..B1.11
  84. ..B1.8:
  85. cmpl $0, 12(%ebp)
  86. jne ..B1.10
  87. ..B1.9:
  88. cmpl $0, 8(%ebp)
  89. je ..B1.11
  90. ..B1.10:
  91. fldl _smallest_value_64@GOTOFF(%edi)
  92. fstpl 8(%esp)
  93. ..B1.11:
  94. xorl %eax, %eax
  95. xorl %edx, %edx
  96. addl $36, %esp
  97. popl %ebx
  98. popl %edi
  99. popl %esi
  100. movl %ebp, %esp
  101. popl %ebp
  102. ret
  103. ..B1.12:
  104. movl iones@GOTOFF(%edi,%ebx,4), %eax
  105. cltd
  106. addl $36, %esp
  107. popl %ebx
  108. popl %edi
  109. popl %esi
  110. movl %ebp, %esp
  111. popl %ebp
  112. ret
  113. ..B1.13:
  114. negl %eax
  115. movl 12(%ebp), %esi
  116. movl %esi, %edi
  117. lea 30(%eax), %ecx
  118. addl $29, %eax
  119. shrl %cl, %edi
  120. movl %eax, %ecx
  121. shrl %cl, %esi
  122. andl $1, %esi
  123. addl %esi, %edi
  124. movl %edi, %eax
  125. negl %eax
  126. testl %ebx, %ebx
  127. jne ..L3
  128. movl %edi, %eax
  129. ..L3:
  130. cltd
  131. addl $36, %esp
  132. popl %ebx
  133. popl %edi
  134. popl %esi
  135. movl %ebp, %esp
  136. popl %ebp
  137. ret
  138. ..B1.14:
  139. negl %eax
  140. addl $30, %eax
  141. movl 12(%ebp), %edx
  142. movl %edx, %esi
  143. movl %eax, %ecx
  144. andl $1, %esi
  145. shrl %cl, %edx
  146. xorl %eax, %eax
  147. addl %edx, %esi
  148. xorl %edx, %edx
  149. subl %esi, %eax
  150. sbbl $0, %edx
  151. testl %ebx, %ebx
  152. jne ..L4
  153. movl %esi, %eax
  154. ..L4:
  155. jne ..L5
  156. movl $0, %edx
  157. ..L5:
  158. addl $36, %esp
  159. popl %ebx
  160. popl %edi
  161. popl %esi
  162. movl %ebp, %esp
  163. popl %ebp
  164. ret
  165. ..B1.15:
  166. movl 8(%ebp), %ecx
  167. xorl %esi, %esi
  168. shrl $31, %ecx
  169. xorl %eax, %eax
  170. addl 12(%ebp), %ecx
  171. adcl $0, %esi
  172. xorl %edx, %edx
  173. subl %ecx, %eax
  174. sbbl %esi, %edx
  175. testl %ebx, %ebx
  176. jne ..L6
  177. movl %ecx, %eax
  178. ..L6:
  179. jne ..L7
  180. movl %esi, %edx
  181. ..L7:
  182. addl $36, %esp
  183. popl %ebx
  184. popl %edi
  185. popl %esi
  186. movl %ebp, %esp
  187. popl %ebp
  188. ret
  189. ..B1.16:
  190. movl %eax, %esi
  191. addl $2, %eax
  192. negl %esi
  193. movl 12(%ebp), %edi
  194. movl %esi, (%esp)
  195. lea 30(%esi), %edx
  196. movl %edi, %esi
  197. movl %edx, %ecx
  198. shrl %cl, %esi
  199. movl %eax, %ecx
  200. shll %cl, %edi
  201. movl %edx, %ecx
  202. movl 8(%ebp), %edx
  203. movl %edx, %eax
  204. shrl %cl, %eax
  205. movl (%esp), %ecx
  206. orl %eax, %edi
  207. addl $29, %ecx
  208. xorl %eax, %eax
  209. shrl %cl, %edx
  210. andl $1, %edx
  211. addl %edx, %edi
  212. adcl $0, %esi
  213. xorl %edx, %edx
  214. subl %edi, %eax
  215. sbbl %esi, %edx
  216. testl %ebx, %ebx
  217. jne ..L8
  218. movl %edi, %eax
  219. ..L8:
  220. jne ..L9
  221. movl %esi, %edx
  222. ..L9:
  223. addl $36, %esp
  224. popl %ebx
  225. popl %edi
  226. popl %esi
  227. movl %ebp, %esp
  228. popl %ebp
  229. ret
  230. ..B1.17:
  231. cmpl $16447, %eax
  232. jge ..B1.29
  233. ..B1.18:
  234. movl %ebx, %edx
  235. xorl %esi, %esi
  236. addl $-1, %edx
  237. movl %edx, 20(%esp)
  238. adcl $2147483647, %esi
  239. movl %esi, 16(%esp)
  240. cmpl $16446, %eax
  241. movl 12(%ebp), %edx
  242. movl 8(%ebp), %esi
  243. jge ..B1.21
  244. ..B1.19:
  245. movl %ebx, (%esp)
  246. movl %esi, %ebx
  247. shrl $1, %ebx
  248. movl %edx, %ecx
  249. shll $31, %edx
  250. andl $1, %esi
  251. orl %ebx, %edx
  252. shrl $1, %ecx
  253. addl %edx, %esi
  254. movl %ecx, %edx
  255. movl (%esp), %ebx
  256. adcl $0, %edx
  257. ..B1.21:
  258. xorl %ecx, %ecx
  259. subl %esi, %ecx
  260. movl %eax, 28(%esp)
  261. movl $0, %eax
  262. sbbl %edx, %eax
  263. testl %ebx, %ebx
  264. jne ..L10
  265. movl %esi, %ecx
  266. ..L10:
  267. jne ..L11
  268. movl %edx, %eax
  269. ..L11:
  270. movl %ecx, 24(%esp)
  271. subl %esi, %ecx
  272. movl %eax, (%esp)
  273. sbbl %edx, %eax
  274. movl 28(%esp), %eax
  275. jb ..B1.23
  276. ..B1.22:
  277. movl $1, %ebx
  278. jmp ..B1.24
  279. ..B1.23:
  280. xorl %ebx, %ebx
  281. ..B1.24:
  282. subl 20(%esp), %esi
  283. sbbl 16(%esp), %edx
  284. jb ..B1.25
  285. ..B1.40:
  286. orl %edx, %esi
  287. jne ..B1.26
  288. ..B1.25:
  289. movl $1, %edx
  290. jmp ..B1.27
  291. ..B1.26:
  292. xorl %edx, %edx
  293. ..B1.27:
  294. testl %edx, %ebx
  295. je ..B1.29
  296. ..B1.28:
  297. movl 24(%esp), %eax
  298. movl (%esp), %edx
  299. addl $36, %esp
  300. popl %ebx
  301. popl %edi
  302. popl %esi
  303. movl %ebp, %esp
  304. popl %ebp
  305. ret
  306. ..B1.29:
  307. fldl _infs@GOTOFF(%edi)
  308. cmpl $32767, %eax
  309. fmull _zeros@GOTOFF(%edi)
  310. fstpl 8(%esp)
  311. jne ..B1.32
  312. ..B1.30:
  313. cmpl $-2147483648, 12(%ebp)
  314. jne ..B1.37
  315. ..B1.31:
  316. cmpl $0, 8(%ebp)
  317. jne ..B1.37
  318. ..B1.32:
  319. fnstcw 6(%esp)
  320. ..B1.33:
  321. movzwl 6(%esp), %edx
  322. movl %edx, %eax
  323. andl $768, %eax
  324. cmpl $768, %eax
  325. je ..B1.37
  326. ..B1.34:
  327. orl $-64768, %edx
  328. movw %dx, 4(%esp)
  329. ..B1.35:
  330. fldcw 4(%esp)
  331. ..B1.36:
  332. fldcw 6(%esp)
  333. ..B1.37:
  334. xorl %eax, %eax
  335. movl $-2147483648, %edx
  336. addl $36, %esp
  337. popl %ebx
  338. popl %edi
  339. popl %esi
  340. movl %ebp, %esp
  341. popl %ebp
  342. ret
  343. .align 16,0x90
  344. .type llroundl,@function
  345. .size llroundl,.-llroundl
  346. .data
  347. # -- End llroundl
  348. .section .rodata, "a"
  349. .align 4
  350. .align 4
  351. _smallest_value_64:
  352. .long 1
  353. .long 0
  354. .long 1
  355. .long 2147483648
  356. .type _smallest_value_64,@object
  357. .size _smallest_value_64,16
  358. .align 4
  359. iones:
  360. .long 1
  361. .long -1
  362. .type iones,@object
  363. .size iones,8
  364. .align 4
  365. _infs:
  366. .long 0
  367. .long 2146435072
  368. .long 0
  369. .long 4293918720
  370. .type _infs,@object
  371. .size _infs,16
  372. .align 4
  373. _zeros:
  374. .long 0
  375. .long 0
  376. .long 0
  377. .long 2147483648
  378. .type _zeros,@object
  379. .size _zeros,16
  380. .data
  381. .section .note.GNU-stack, ""
  382. # End