remainderl.S 8.0 KB

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