floorl.S 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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 "floorl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin floorl
  41. .text
  42. .align 16,0x90
  43. .globl floorl
  44. floorl:
  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. jbe ..B1.12
  91. ..B1.10:
  92. fldt (%esp)
  93. faddl 8+_ones@GOTOFF(%edx)
  94. fstpt (%esp)
  95. ..B1.12:
  96. testl %ecx, %ecx
  97. je ..B1.14
  98. ..B1.13:
  99. fldcw 14(%esp)
  100. ..B1.14:
  101. fldt (%esp)
  102. movl %ebp, %esp
  103. popl %ebp
  104. ret
  105. ..B1.15:
  106. testl %eax, %eax
  107. jne ..B1.20
  108. ..B1.16:
  109. cmpl $0, 12(%ebp)
  110. jne ..B1.19
  111. ..B1.17:
  112. cmpl $0, 8(%ebp)
  113. jne ..B1.19
  114. ..B1.18:
  115. fldt 8(%ebp)
  116. movl %ebp, %esp
  117. popl %ebp
  118. ret
  119. ..B1.19:
  120. fldl _smallest_value_64@GOTOFF(%edx)
  121. fstpl 16(%esp)
  122. ..B1.20:
  123. movzbl 17(%ebp), %eax
  124. andl $128, %eax
  125. shrl $7, %eax
  126. fldl _pzero_none@GOTOFF(%edx,%eax,8)
  127. movl %ebp, %esp
  128. popl %ebp
  129. ret
  130. ..B1.21:
  131. cmpl $16446, %eax
  132. jge ..B1.30
  133. ..B1.22:
  134. testb $1, 8(%ebp)
  135. je ..B1.29
  136. ..B1.23:
  137. movzwl 14(%esp), %ecx
  138. movl %ecx, %eax
  139. andl $768, %eax
  140. cmpl $768, %eax
  141. je ..B1.37
  142. ..B1.24:
  143. orl $-64768, %ecx
  144. movw %cx, 12(%esp)
  145. ..B1.25:
  146. fldcw 12(%esp)
  147. ..B1.26:
  148. fldt 8(%ebp)
  149. faddl 8+_halfs@GOTOFF(%edx)
  150. fstpt (%esp)
  151. ..B1.27:
  152. fldcw 14(%esp)
  153. ..B1.28:
  154. fldt (%esp)
  155. movl %ebp, %esp
  156. popl %ebp
  157. ret
  158. ..B1.29:
  159. fldt 8(%ebp)
  160. movl %ebp, %esp
  161. popl %ebp
  162. ret
  163. ..B1.30:
  164. movzwl 14(%esp), %ecx
  165. movl %ecx, %eax
  166. andl $768, %eax
  167. cmpl $768, %eax
  168. je ..B1.38
  169. ..B1.31:
  170. orl $-64768, %ecx
  171. movw %cx, 12(%esp)
  172. ..B1.32:
  173. fldcw 12(%esp)
  174. ..B1.33:
  175. fldt 8(%ebp)
  176. fmull _ones@GOTOFF(%edx)
  177. fstpt (%esp)
  178. ..B1.34:
  179. fldcw 14(%esp)
  180. ..B1.35:
  181. fldt (%esp)
  182. movl %ebp, %esp
  183. popl %ebp
  184. ret
  185. ..B1.36:
  186. xorl %ecx, %ecx
  187. jmp ..B1.9
  188. ..B1.37:
  189. fldt 8(%ebp)
  190. faddl 8+_halfs@GOTOFF(%edx)
  191. fstpt (%esp)
  192. jmp ..B1.28
  193. ..B1.38:
  194. fldt 8(%ebp)
  195. fmull _ones@GOTOFF(%edx)
  196. fstpt (%esp)
  197. jmp ..B1.35
  198. .align 16,0x90
  199. .type floorl,@function
  200. .size floorl,.-floorl
  201. .data
  202. # -- End floorl
  203. .section .rodata, "a"
  204. .align 4
  205. .align 4
  206. _TWO_63H:
  207. .long 0
  208. .long 1139277824
  209. .type _TWO_63H,@object
  210. .size _TWO_63H,8
  211. .align 4
  212. _ones:
  213. .long 0
  214. .long 1072693248
  215. .long 0
  216. .long 3220176896
  217. .type _ones,@object
  218. .size _ones,16
  219. .align 4
  220. _smallest_value_64:
  221. .long 1
  222. .long 0
  223. .long 1
  224. .long 2147483648
  225. .type _smallest_value_64,@object
  226. .size _smallest_value_64,16
  227. .align 4
  228. _pzero_none:
  229. .long 0
  230. .long 0
  231. .long 0
  232. .long 3220176896
  233. .type _pzero_none,@object
  234. .size _pzero_none,16
  235. .align 4
  236. _halfs:
  237. .long 0
  238. .long 1071644672
  239. .long 0
  240. .long 3219128320
  241. .type _halfs,@object
  242. .size _halfs,16
  243. .data
  244. .section .note.GNU-stack, ""
  245. # End