nearbyint_wmt.S 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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 "nearbyint_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 nearbyint
  59. .text
  60. .align 16,0x90
  61. .globl nearbyint
  62. nearbyint:
  63. # parameter 1: 8 + %ebp
  64. ..B2.1:
  65. ..L3:
  66. ..B2.2:
  67. pushl %ebp
  68. movl %esp, %ebp
  69. subl $104, %esp
  70. movl %ebx, 48(%esp)
  71. call static_func
  72. movl %eax, %ebx
  73. movsd 112(%esp), %xmm0
  74. pextrw $3, %xmm0, %ecx
  75. movl $32752, %eax
  76. andl %ecx, %eax
  77. cmpl $17200, %eax
  78. jge .L_2TAG_PACKET_0.0.2
  79. fnstcw 8(%esp)
  80. subl $16368, %eax
  81. jl .L_2TAG_PACKET_1.0.2
  82. movzwl 8(%esp), %edx
  83. andl $3072, %edx
  84. jne .L_2TAG_PACKET_2.0.2
  85. movq (%ebx), %xmm1
  86. movq 16(%ebx), %xmm2
  87. pand %xmm0, %xmm1
  88. movq 32(%ebx), %xmm4
  89. movq 32(%ebx), %xmm3
  90. psubq 48(%ebx), %xmm1
  91. pand %xmm0, %xmm2
  92. psrlq $52, %xmm1
  93. movapd %xmm0, %xmm5
  94. psllq %xmm1, %xmm0
  95. por 48(%ebx), %xmm2
  96. pand %xmm0, %xmm4
  97. pand 64(%ebx), %xmm0
  98. psrlq %xmm1, %xmm3
  99. por 80(%ebx), %xmm0
  100. por 48(%ebx), %xmm4
  101. pandn %xmm5, %xmm3
  102. cmpeqsd 96(%ebx), %xmm0
  103. cmpnlesd 96(%ebx), %xmm4
  104. por %xmm4, %xmm0
  105. pand %xmm2, %xmm0
  106. addsd %xmm3, %xmm0
  107. movq %xmm0, (%esp)
  108. fldl (%esp)
  109. jmp .L_2TAG_PACKET_3.0.2
  110. .L_2TAG_PACKET_2.0.2:
  111. cmpl $3072, %edx
  112. je .L_2TAG_PACKET_4.0.2
  113. testl $1024, %edx
  114. je .L_2TAG_PACKET_5.0.2
  115. movq (%ebx), %xmm1
  116. pand %xmm0, %xmm1
  117. xorpd %xmm2, %xmm2
  118. movq 32(%ebx), %xmm3
  119. psubq 48(%ebx), %xmm1
  120. movapd %xmm0, %xmm5
  121. xorpd %xmm4, %xmm4
  122. psrlq $52, %xmm1
  123. cmpnlesd %xmm0, %xmm2
  124. psllq %xmm1, %xmm0
  125. pand 32(%ebx), %xmm0
  126. pcmpeqd %xmm4, %xmm0
  127. psrlq %xmm1, %xmm3
  128. pshufd $1, %xmm0, %xmm4
  129. pandn %xmm5, %xmm3
  130. pand %xmm4, %xmm0
  131. pandn %xmm2, %xmm0
  132. pand 48(%ebx), %xmm0
  133. subsd %xmm0, %xmm3
  134. movq %xmm3, (%esp)
  135. fldl (%esp)
  136. jmp .L_2TAG_PACKET_3.0.2
  137. .L_2TAG_PACKET_5.0.2:
  138. movq (%ebx), %xmm1
  139. pand %xmm0, %xmm1
  140. xorpd %xmm2, %xmm2
  141. movq 32(%ebx), %xmm3
  142. psubq 48(%ebx), %xmm1
  143. movapd %xmm0, %xmm5
  144. xorpd %xmm4, %xmm4
  145. psrlq $52, %xmm1
  146. cmplesd %xmm0, %xmm2
  147. psllq %xmm1, %xmm0
  148. pand 32(%ebx), %xmm0
  149. pcmpeqd %xmm4, %xmm0
  150. psrlq %xmm1, %xmm3
  151. pshufd $1, %xmm0, %xmm4
  152. pandn %xmm5, %xmm3
  153. pand %xmm4, %xmm0
  154. pandn %xmm2, %xmm0
  155. pand 48(%ebx), %xmm0
  156. addsd %xmm3, %xmm0
  157. movq %xmm0, (%esp)
  158. fldl (%esp)
  159. jmp .L_2TAG_PACKET_3.0.2
  160. .L_2TAG_PACKET_4.0.2:
  161. movq (%ebx), %xmm1
  162. pand %xmm0, %xmm1
  163. movq 32(%ebx), %xmm3
  164. psubq 48(%ebx), %xmm1
  165. psrlq $52, %xmm1
  166. psrlq %xmm1, %xmm3
  167. pandn %xmm0, %xmm3
  168. movq %xmm3, (%esp)
  169. fldl (%esp)
  170. jmp .L_2TAG_PACKET_3.0.2
  171. .L_2TAG_PACKET_1.0.2:
  172. movzwl 8(%esp), %edx
  173. andl $3072, %edx
  174. jne .L_2TAG_PACKET_6.0.2
  175. andpd 112(%ebx), %xmm0
  176. addl $16, %eax
  177. shrl $14, %ecx
  178. shrl $31, %eax
  179. ucomisd 128(%ebx), %xmm0
  180. je .L_2TAG_PACKET_7.0.2
  181. andl $2, %ecx
  182. orl %ecx, %eax
  183. flds 144(%ebx,%eax,4)
  184. jmp .L_2TAG_PACKET_3.0.2
  185. .L_2TAG_PACKET_7.0.2:
  186. shrl $15, %ecx
  187. flds 160(%ebx,%ecx,4)
  188. jmp .L_2TAG_PACKET_3.0.2
  189. .L_2TAG_PACKET_6.0.2:
  190. cmpl $3072, %edx
  191. je .L_2TAG_PACKET_8.0.2
  192. testl $1024, %edx
  193. je .L_2TAG_PACKET_9.0.2
  194. pxor %xmm1, %xmm1
  195. cmpnlesd %xmm0, %xmm1
  196. movd %xmm1, %eax
  197. shrl $15, %ecx
  198. subl %eax, %ecx
  199. flds 176(%ebx,%ecx,4)
  200. jmp .L_2TAG_PACKET_3.0.2
  201. .L_2TAG_PACKET_9.0.2:
  202. pxor %xmm1, %xmm1
  203. cmpnltsd %xmm0, %xmm1
  204. movd %xmm1, %eax
  205. shrl $15, %ecx
  206. subl %ecx, %eax
  207. flds 200(%ebx,%eax,4)
  208. jmp .L_2TAG_PACKET_3.0.2
  209. .L_2TAG_PACKET_8.0.2:
  210. shrl $15, %ecx
  211. flds 208(%ebx,%ecx,4)
  212. jmp .L_2TAG_PACKET_3.0.2
  213. .L_2TAG_PACKET_0.0.2:
  214. movq %xmm0, (%esp)
  215. fldl (%esp)
  216. fldz
  217. faddp
  218. .L_2TAG_PACKET_3.0.2:
  219. movl 48(%esp), %ebx
  220. movl %ebp, %esp
  221. popl %ebp
  222. ret
  223. ..B2.3:
  224. .align 16,0x90
  225. .type nearbyint,@function
  226. .size nearbyint,.-nearbyint
  227. .data
  228. # -- End nearbyint
  229. .section .rodata, "a"
  230. .align 16
  231. .align 16
  232. static_const_table:
  233. .long 0
  234. .long 2146435072
  235. .long 0
  236. .long 0
  237. .long 0
  238. .long 2147483648
  239. .long 0
  240. .long 0
  241. .long 4294967295
  242. .long 1048575
  243. .long 4294967295
  244. .long 1048575
  245. .long 0
  246. .long 1072693248
  247. .long 0
  248. .long 3220176896
  249. .long 4294967295
  250. .long 2097151
  251. .long 4294967295
  252. .long 2097151
  253. .long 0
  254. .long 1071644672
  255. .long 0
  256. .long 1071644672
  257. .long 0
  258. .long 1073217536
  259. .long 0
  260. .long 1073217536
  261. .long 4294967295
  262. .long 2147483647
  263. .long 0
  264. .long 0
  265. .long 0
  266. .long 1071644672
  267. .long 0
  268. .long 3219128320
  269. .long 1065353216
  270. .long 0
  271. .long 3212836864
  272. .long 2147483648
  273. .long 0
  274. .long 2147483648
  275. .long 0
  276. .long 0
  277. .long 0
  278. .long 2147483648
  279. .long 3212836864
  280. .long 0
  281. .long 2147483648
  282. .long 0
  283. .long 1065353216
  284. .long 0
  285. .long 0
  286. .long 2147483648
  287. .long 0
  288. .long 0
  289. .type static_const_table,@object
  290. .size static_const_table,224
  291. .data
  292. .section .note.GNU-stack, ""
  293. # End