ldexpl.S 8.1 KB

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