ceill.S 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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 "ceill.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin ceill
  41. .text
  42. .align 16,0x90
  43. .globl ceill
  44. ceill:
  45. # parameter 1: 8 + %ebp
  46. ..B1.1:
  47. ..L1:
  48. pushl %ebp
  49. movl %esp, %ebp
  50. andl $-16, %esp
  51. subl $32, %esp
  52. ..B1.2:
  53. fnstcw 14(%esp)
  54. ..B1.3:
  55. movzwl 16(%ebp), %eax
  56. andl $32767, %eax
  57. call ..L2
  58. ..L2:
  59. popl %edx
  60. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx
  61. cmpl $16445, %eax
  62. jge ..B1.21
  63. ..B1.4:
  64. cmpl $16383, %eax
  65. jl ..B1.15
  66. ..B1.5:
  67. movzwl 14(%esp), %ecx
  68. movl %ecx, %eax
  69. andl $768, %eax
  70. cmpl $768, %eax
  71. je ..B1.36
  72. ..B1.6:
  73. orl $-64768, %ecx
  74. movw %cx, 12(%esp)
  75. ..B1.7:
  76. fldcw 12(%esp)
  77. ..B1.8:
  78. movl $1, %ecx
  79. ..B1.9:
  80. fldt 8(%ebp)
  81. fld %st(0)
  82. fldl _TWO_63H@GOTOFF(%edx)
  83. fadd %st, %st(1)
  84. fsubrp %st, %st(1)
  85. fstpt (%esp)
  86. fldt (%esp)
  87. fcompp
  88. fnstsw %ax
  89. sahf
  90. jae ..B1.12
  91. jp ..B1.12
  92. ..B1.10:
  93. fldt (%esp)
  94. faddl _ones@GOTOFF(%edx)
  95. fstpt (%esp)
  96. ..B1.12:
  97. testl %ecx, %ecx
  98. je ..B1.14
  99. ..B1.13:
  100. fldcw 14(%esp)
  101. ..B1.14:
  102. fldt (%esp)
  103. movl %ebp, %esp
  104. popl %ebp
  105. ret
  106. ..B1.15:
  107. testl %eax, %eax
  108. jne ..B1.20
  109. ..B1.16:
  110. cmpl $0, 12(%ebp)
  111. jne ..B1.19
  112. ..B1.17:
  113. cmpl $0, 8(%ebp)
  114. jne ..B1.19
  115. ..B1.18:
  116. fldt 8(%ebp)
  117. movl %ebp, %esp
  118. popl %ebp
  119. ret
  120. ..B1.19:
  121. fldl _smallest_value_64@GOTOFF(%edx)
  122. fstpl 16(%esp)
  123. ..B1.20:
  124. movzbl 17(%ebp), %eax
  125. andl $128, %eax
  126. shrl $7, %eax
  127. fldl _pone_nzero@GOTOFF(%edx,%eax,8)
  128. movl %ebp, %esp
  129. popl %ebp
  130. ret
  131. ..B1.21:
  132. cmpl $16446, %eax
  133. jge ..B1.30
  134. ..B1.22:
  135. testb $1, 8(%ebp)
  136. je ..B1.29
  137. ..B1.23:
  138. movzwl 14(%esp), %ecx
  139. movl %ecx, %eax
  140. andl $768, %eax
  141. cmpl $768, %eax
  142. je ..B1.37
  143. ..B1.24:
  144. orl $-64768, %ecx
  145. movw %cx, 12(%esp)
  146. ..B1.25:
  147. fldcw 12(%esp)
  148. ..B1.26:
  149. fldt 8(%ebp)
  150. faddl _halfs@GOTOFF(%edx)
  151. fstpt (%esp)
  152. ..B1.27:
  153. fldcw 14(%esp)
  154. ..B1.28:
  155. fldt (%esp)
  156. movl %ebp, %esp
  157. popl %ebp
  158. ret
  159. ..B1.29:
  160. fldt 8(%ebp)
  161. movl %ebp, %esp
  162. popl %ebp
  163. ret
  164. ..B1.30:
  165. movzwl 14(%esp), %ecx
  166. movl %ecx, %eax
  167. andl $768, %eax
  168. cmpl $768, %eax
  169. je ..B1.38
  170. ..B1.31:
  171. orl $-64768, %ecx
  172. movw %cx, 12(%esp)
  173. ..B1.32:
  174. fldcw 12(%esp)
  175. ..B1.33:
  176. fldt 8(%ebp)
  177. fmull _ones@GOTOFF(%edx)
  178. fstpt (%esp)
  179. ..B1.34:
  180. fldcw 14(%esp)
  181. ..B1.35:
  182. fldt (%esp)
  183. movl %ebp, %esp
  184. popl %ebp
  185. ret
  186. ..B1.36:
  187. xorl %ecx, %ecx
  188. jmp ..B1.9
  189. ..B1.37:
  190. fldt 8(%ebp)
  191. faddl _halfs@GOTOFF(%edx)
  192. fstpt (%esp)
  193. jmp ..B1.28
  194. ..B1.38:
  195. fldt 8(%ebp)
  196. fmull _ones@GOTOFF(%edx)
  197. fstpt (%esp)
  198. jmp ..B1.35
  199. .align 16,0x90
  200. .type ceill,@function
  201. .size ceill,.-ceill
  202. .data
  203. # -- End ceill
  204. .section .rodata, "a"
  205. .align 4
  206. .align 4
  207. _TWO_63H:
  208. .long 0
  209. .long 1139277824
  210. .type _TWO_63H,@object
  211. .size _TWO_63H,8
  212. .align 4
  213. _ones:
  214. .long 0
  215. .long 1072693248
  216. .long 0
  217. .long 3220176896
  218. .type _ones,@object
  219. .size _ones,16
  220. .align 4
  221. _smallest_value_64:
  222. .long 1
  223. .long 0
  224. .long 1
  225. .long 2147483648
  226. .type _smallest_value_64,@object
  227. .size _smallest_value_64,16
  228. .align 4
  229. _pone_nzero:
  230. .long 0
  231. .long 1072693248
  232. .long 0
  233. .long 2147483648
  234. .type _pone_nzero,@object
  235. .size _pone_nzero,16
  236. .align 4
  237. _halfs:
  238. .long 0
  239. .long 1071644672
  240. .long 0
  241. .long 3219128320
  242. .type _halfs,@object
  243. .size _halfs,16
  244. .data
  245. .section .note.GNU-stack, ""
  246. # End