nexttowardl.S 9.0 KB

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