q2l.S 8.9 KB

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