nexttowardf_wmt.S 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 "nexttowardf_wmt.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin nexttowardf
  41. .text
  42. .align 16,0x90
  43. .globl nexttowardf
  44. nexttowardf:
  45. # parameter 1: 32 + %esp
  46. # parameter 2: 36 + %esp
  47. ..B1.1:
  48. ..L1:
  49. pushl %edi
  50. pushl %ebx
  51. subl $20, %esp
  52. movzwl 34(%esp), %eax
  53. andl $32640, %eax
  54. cmpl $32640, %eax
  55. je ..B1.23
  56. ..B1.2:
  57. movzwl 44(%esp), %ecx
  58. andl $32767, %ecx
  59. cmpl $32767, %ecx
  60. je ..B1.20
  61. ..B1.3:
  62. flds 32(%esp)
  63. fldt 36(%esp)
  64. fucom %st(1)
  65. fnstsw %ax
  66. sahf
  67. jp ..B1.4
  68. je ..B1.24
  69. ..B1.4:
  70. fstp %st(0)
  71. movl 32(%esp), %eax
  72. testl $2147483647, %eax
  73. call ..L2
  74. ..L2:
  75. popl %edx
  76. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx
  77. je ..B1.19
  78. ..B1.5:
  79. fstpt (%esp)
  80. movzbl 9(%esp), %edi
  81. movzbl 45(%esp), %ebx
  82. andl $128, %edi
  83. andl $128, %ebx
  84. shrl $7, %edi
  85. shrl $7, %ebx
  86. cmpl %edi, %ebx
  87. jne ..B1.11
  88. ..B1.6:
  89. movzwl 8(%esp), %ebx
  90. andl $32767, %ebx
  91. cmpl %ecx, %ebx
  92. jg ..B1.11
  93. ..B1.7:
  94. jne ..B1.12
  95. ..B1.8:
  96. movl 4(%esp), %ecx
  97. movl 40(%esp), %ebx
  98. cmpl %ebx, %ecx
  99. ja ..B1.11
  100. ..B1.9:
  101. jne ..B1.12
  102. ..B1.10:
  103. movl (%esp), %ecx
  104. cmpl 36(%esp), %ecx
  105. jbe ..B1.12
  106. ..B1.11:
  107. decl %eax
  108. movl %eax, (%esp)
  109. jmp ..B1.13
  110. ..B1.12:
  111. incl %eax
  112. movl %eax, (%esp)
  113. ..B1.13:
  114. andl $2147483647, %eax
  115. lea -8388608(%eax), %ecx
  116. cmpl $2130706432, %ecx
  117. jb ..B1.18
  118. ..B1.14:
  119. cmpl $8388608, %eax
  120. jae ..B1.16
  121. ..B1.15:
  122. flds .L_2il0floatpacket.0@GOTOFF(%edx)
  123. fsts 12(%esp)
  124. flds 12(%esp)
  125. fmulp %st, %st(1)
  126. fstps 12(%esp)
  127. flds (%esp)
  128. addl $20, %esp
  129. popl %ebx
  130. popl %edi
  131. ret
  132. ..B1.16:
  133. flds .L_2il0floatpacket.1@GOTOFF(%edx)
  134. fsts 12(%esp)
  135. flds 12(%esp)
  136. fmulp %st, %st(1)
  137. fstps 12(%esp)
  138. flds (%esp)
  139. ..B1.17:
  140. addl $20, %esp
  141. popl %ebx
  142. popl %edi
  143. ret
  144. ..B1.18:
  145. flds (%esp)
  146. addl $20, %esp
  147. popl %ebx
  148. popl %edi
  149. ret
  150. ..B1.19:
  151. fstp %st(0)
  152. movzbl 45(%esp), %eax
  153. andl $128, %eax
  154. shrl $7, %eax
  155. flds .L_2il0floatpacket.0@GOTOFF(%edx)
  156. fsts 12(%esp)
  157. flds 12(%esp)
  158. fmulp %st, %st(1)
  159. movl _smallest_value_32@GOTOFF(%edx,%eax,4), %ecx
  160. movl %ecx, (%esp)
  161. fstps 12(%esp)
  162. jmp ..B1.18
  163. ..B1.20:
  164. cmpl $-2147483648, 40(%esp)
  165. jne ..B1.22
  166. ..B1.21:
  167. cmpl $0, 36(%esp)
  168. je ..B1.3
  169. ..B1.22:
  170. fldt 36(%esp)
  171. fmuls 32(%esp)
  172. addl $20, %esp
  173. popl %ebx
  174. popl %edi
  175. ret
  176. ..B1.23:
  177. testl $8388607, 32(%esp)
  178. jne ..B1.22
  179. jmp ..B1.2
  180. ..B1.24:
  181. fstp %st(1)
  182. addl $20, %esp
  183. popl %ebx
  184. popl %edi
  185. ret
  186. .align 16,0x90
  187. .type nexttowardf,@function
  188. .size nexttowardf,.-nexttowardf
  189. .data
  190. # -- End nexttowardf
  191. .section .rodata, "a"
  192. .align 4
  193. .align 4
  194. .L_2il0floatpacket.0:
  195. .long 0x0d800000
  196. .type .L_2il0floatpacket.0,@object
  197. .size .L_2il0floatpacket.0,4
  198. .align 4
  199. .L_2il0floatpacket.1:
  200. .long 0x71800000
  201. .type .L_2il0floatpacket.1,@object
  202. .size .L_2il0floatpacket.1,4
  203. .align 4
  204. _smallest_value_32:
  205. .long 1
  206. .long 2147483649
  207. .type _smallest_value_32,@object
  208. .size _smallest_value_32,8
  209. .data
  210. .section .note.GNU-stack, ""
  211. # End