floorl.S 6.2 KB

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