nearbyintf_gen.S 9.6 KB

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