llround_wmt.S 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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 "llround_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 llround
  59. .text
  60. .align 16,0x90
  61. .globl llround
  62. llround:
  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. movsd %xmm0, 16(%esp)
  75. pextrw $3, %xmm0, %eax
  76. movl $32767, %edx
  77. andl %eax, %edx
  78. cmpl $17200, %edx
  79. jge .L_2TAG_PACKET_0.0.3
  80. cmpl $16368, %edx
  81. jl .L_2TAG_PACKET_1.0.3
  82. movapd %xmm0, %xmm5
  83. movapd 112(%ebx), %xmm4
  84. pxor %xmm6, %xmm6
  85. pand %xmm0, %xmm4
  86. movapd %xmm0, %xmm1
  87. psrlq $52, %xmm0
  88. cmpltsd %xmm6, %xmm5
  89. pand 64(%ebx), %xmm0
  90. movss 80(%ebx), %xmm2
  91. movss 96(%ebx), %xmm3
  92. pcmpeqd %xmm6, %xmm6
  93. psubd %xmm0, %xmm2
  94. psubd %xmm0, %xmm3
  95. psrlq %xmm3, %xmm1
  96. por 128(%ebx), %xmm4
  97. pand 144(%ebx), %xmm1
  98. psrlq %xmm2, %xmm4
  99. pxor %xmm5, %xmm6
  100. paddq %xmm1, %xmm4
  101. pand %xmm4, %xmm5
  102. pand %xmm4, %xmm6
  103. psubq %xmm5, %xmm6
  104. movd %xmm6, %eax
  105. psrlq $32, %xmm6
  106. movd %xmm6, %edx
  107. jmp .L_2TAG_PACKET_2.0.3
  108. .L_2TAG_PACKET_0.0.3:
  109. comisd 16(%ebx), %xmm0
  110. jc .L_2TAG_PACKET_3.0.3
  111. comisd (%ebx), %xmm0
  112. jnc .L_2TAG_PACKET_3.0.3
  113. .L_2TAG_PACKET_4.0.3:
  114. fldl 16(%esp)
  115. subl $8, %esp
  116. fistpll (%esp)
  117. popl %eax
  118. popl %edx
  119. jmp .L_2TAG_PACKET_2.0.3
  120. .L_2TAG_PACKET_1.0.3:
  121. subl $16352, %edx
  122. xorl $32768, %eax
  123. movl $1, %ecx
  124. shrl $31, %edx
  125. shrl $15, %eax
  126. xorl %edx, %ecx
  127. orl %eax, %edx
  128. andl %ecx, %eax
  129. shll $31, %ecx
  130. addl %edx, %eax
  131. movl 20(%esp), %edx
  132. subl $1, %eax
  133. andl %ecx, %edx
  134. sarl $31, %edx
  135. jmp .L_2TAG_PACKET_2.0.3
  136. .L_2TAG_PACKET_3.0.3:
  137. jp .L_2TAG_PACKET_5.0.3
  138. pcmpeqd %xmm1, %xmm1
  139. pslld $23, %xmm1
  140. subss %xmm1, %xmm1
  141. movl $0, (%esp)
  142. movl $-2147483648, 4(%esp)
  143. subl $32, %esp
  144. lea 128(%esp), %eax
  145. movl %eax, (%esp)
  146. lea 128(%esp), %eax
  147. movl %eax, 4(%esp)
  148. lea 32(%esp), %eax
  149. movl %eax, 8(%esp)
  150. movl $194, %eax
  151. movl %eax, 12(%esp)
  152. call __libm_error_support
  153. addl $32, %esp
  154. movl (%esp), %eax
  155. movl 4(%esp), %edx
  156. jmp .L_2TAG_PACKET_2.0.3
  157. .L_2TAG_PACKET_5.0.3:
  158. movl $-2147483648, %edx
  159. movl $0, %eax
  160. .L_2TAG_PACKET_2.0.3:
  161. movl 64(%esp), %ebx
  162. movl %ebp, %esp
  163. popl %ebp
  164. ret
  165. ..B2.3:
  166. .align 16,0x90
  167. .type llround,@function
  168. .size llround,.-llround
  169. .data
  170. # -- End llround
  171. .text
  172. # -- Begin __libm_error_support
  173. .text
  174. .align 16,0x90
  175. __libm_error_support:
  176. # parameter 1: 4 + %esp
  177. # parameter 2: 8 + %esp
  178. # parameter 3: 12 + %esp
  179. # parameter 4: 16 + %esp
  180. ..B3.1:
  181. ..L4:
  182. ret
  183. .align 16,0x90
  184. .type __libm_error_support,@function
  185. .size __libm_error_support,.-__libm_error_support
  186. .data
  187. # -- End __libm_error_support
  188. .section .rodata, "a"
  189. .align 16
  190. .align 16
  191. static_const_table:
  192. .long 0
  193. .long 1138753536
  194. .long 0
  195. .long 1138753536
  196. .long 0
  197. .long 3286237184
  198. .long 0
  199. .long 3286237184
  200. .long 0
  201. .long 2147483648
  202. .long 0
  203. .long 2147483648
  204. .long 0
  205. .long 1072693248
  206. .long 0
  207. .long 1072693248
  208. .long 2047
  209. .long 0
  210. .long 2047
  211. .long 0
  212. .long 1075
  213. .long 1075
  214. .long 1075
  215. .long 1075
  216. .long 1074
  217. .long 1074
  218. .long 1074
  219. .long 1074
  220. .long 4294967295
  221. .long 1048575
  222. .long 0
  223. .long 0
  224. .long 0
  225. .long 1048576
  226. .long 0
  227. .long 0
  228. .long 1
  229. .long 0
  230. .long 0
  231. .long 0
  232. .type static_const_table,@object
  233. .size static_const_table,160
  234. .data
  235. .section .note.GNU-stack, ""
  236. # End