lround_wmt.S 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 "lround_wmt.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin static_func
  41. .text
  42. .align 16,0x90
  43. static_func:
  44. ..B1.1:
  45. ..L1:
  46. call ..L2
  47. ..L2:
  48. popl %eax
  49. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
  50. lea static_const_table@GOTOFF(%eax), %eax
  51. ret
  52. .align 16,0x90
  53. .type static_func,@function
  54. .size static_func,.-static_func
  55. .data
  56. # -- End static_func
  57. .text
  58. # -- Begin lround
  59. .text
  60. .align 16,0x90
  61. .globl lround
  62. lround:
  63. # parameter 1: 8 + %ebp
  64. ..B2.1:
  65. ..L3:
  66. ..B2.2:
  67. pushl %ebp
  68. movl %esp, %ebp
  69. subl $120, %esp
  70. movl %ebx, 64(%esp)
  71. call static_func
  72. movl %eax, %ebx
  73. movsd 128(%esp), %xmm0
  74. movq %xmm0, 16(%esp)
  75. movq 16(%ebx), %xmm4
  76. movq 64(%ebx), %xmm5
  77. movq 96(%ebx), %xmm3
  78. movq (%ebx), %xmm1
  79. movdqa %xmm4, %xmm2
  80. pandn %xmm0, %xmm4
  81. pand %xmm0, %xmm2
  82. por %xmm5, %xmm2
  83. pextrw $3, %xmm0, %eax
  84. andl $32752, %eax
  85. subl $16368, %eax
  86. cmpl $480, %eax
  87. jae .L_2TAG_PACKET_0.0.3
  88. psrlq $52, %xmm4
  89. psubq %xmm4, %xmm3
  90. psllq %xmm3, %xmm1
  91. addsd %xmm2, %xmm0
  92. pand %xmm1, %xmm0
  93. cvttsd2si %xmm0, %eax
  94. jmp .L_2TAG_PACKET_1.0.3
  95. .L_2TAG_PACKET_0.0.3:
  96. js .L_2TAG_PACKET_2.0.3
  97. movdqa %xmm2, %xmm6
  98. movq 80(%ebx), %xmm7
  99. psrlq $63, %xmm6
  100. paddq %xmm6, %xmm7
  101. cmpl $512, %eax
  102. jge .L_2TAG_PACKET_3.0.3
  103. movq 48(%ebx), %xmm2
  104. addsd %xmm4, %xmm5
  105. psrlq $52, %xmm4
  106. psubq %xmm4, %xmm3
  107. movd %xmm6, %edx
  108. psllq %xmm3, %xmm1
  109. pand %xmm1, %xmm5
  110. addsd %xmm2, %xmm5
  111. por %xmm7, %xmm2
  112. movd %xmm5, %eax
  113. psubd %xmm5, %xmm2
  114. pmovmskb %xmm2, %ecx
  115. andl $136, %ecx
  116. jne .L_2TAG_PACKET_3.0.3
  117. testl %edx, %edx
  118. je .L_2TAG_PACKET_4.0.3
  119. negl %eax
  120. .L_2TAG_PACKET_4.0.3:
  121. jmp .L_2TAG_PACKET_1.0.3
  122. .L_2TAG_PACKET_2.0.3:
  123. addl $16, %eax
  124. js .L_2TAG_PACKET_5.0.3
  125. addsd %xmm2, %xmm2
  126. cvttsd2si %xmm2, %eax
  127. jmp .L_2TAG_PACKET_1.0.3
  128. .L_2TAG_PACKET_5.0.3:
  129. xorl %eax, %eax
  130. jmp .L_2TAG_PACKET_1.0.3
  131. .L_2TAG_PACKET_3.0.3:
  132. movq 32(%ebx), %xmm1
  133. movl $-2147483648, %eax
  134. pxor %xmm2, %xmm2
  135. movd %eax, %xmm7
  136. mulsd %xmm2, %xmm1
  137. ucomisd %xmm0, %xmm0
  138. jc .L_2TAG_PACKET_6.0.3
  139. movq %xmm7, 8(%esp)
  140. subl $32, %esp
  141. lea 128(%esp), %eax
  142. movl %eax, (%esp)
  143. lea 128(%esp), %eax
  144. movl %eax, 4(%esp)
  145. lea 40(%esp), %eax
  146. movl %eax, 8(%esp)
  147. movl $190, %eax
  148. movl %eax, 12(%esp)
  149. call __libm_error_support
  150. addl $32, %esp
  151. movl 8(%esp), %eax
  152. .L_2TAG_PACKET_6.0.3:
  153. .L_2TAG_PACKET_1.0.3:
  154. movl 64(%esp), %ebx
  155. movl %ebp, %esp
  156. popl %ebp
  157. ret
  158. ..B2.3:
  159. .align 16,0x90
  160. .type lround,@function
  161. .size lround,.-lround
  162. .data
  163. # -- End lround
  164. .text
  165. # -- Begin __libm_error_support
  166. .text
  167. .align 16,0x90
  168. __libm_error_support:
  169. # parameter 1: 4 + %esp
  170. # parameter 2: 8 + %esp
  171. # parameter 3: 12 + %esp
  172. # parameter 4: 16 + %esp
  173. ..B3.1:
  174. ..L4:
  175. ret
  176. .align 16,0x90
  177. .type __libm_error_support,@function
  178. .size __libm_error_support,.-__libm_error_support
  179. .data
  180. # -- End __libm_error_support
  181. .section .rodata, "a"
  182. .align 16
  183. .align 16
  184. static_const_table:
  185. .long 4294967295
  186. .long 4294967295
  187. .long 4294967295
  188. .long 4294967295
  189. .long 0
  190. .long 2147483648
  191. .long 0
  192. .long 2147483648
  193. .long 0
  194. .long 2146435072
  195. .long 0
  196. .long 2146435072
  197. .long 0
  198. .long 1127743488
  199. .long 0
  200. .long 1127743488
  201. .long 0
  202. .long 1071644672
  203. .long 0
  204. .long 1071644672
  205. .long 2147483647
  206. .long 0
  207. .long 2147483647
  208. .long 0
  209. .long 1075
  210. .long 0
  211. .long 1075
  212. .long 0
  213. .type static_const_table,@object
  214. .size static_const_table,112
  215. .data
  216. .section .note.GNU-stack, ""
  217. # End