ceill.S 6.2 KB

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