nexttowardf_gen.S 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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_gen.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin nexttowardf
  41. .text
  42. .align 16,0x90
  43. .globl nexttowardf
  44. nexttowardf:
  45. # parameter 1: %xmm0
  46. # parameter 2: 8 + %rsp
  47. ..B1.1:
  48. .cfi_startproc
  49. ..___tag_value_nexttowardf.1:
  50. ..L2:
  51. movss %xmm0, -16(%rsp)
  52. movzwl -14(%rsp), %eax
  53. andl $32640, %eax
  54. cmpl $32640, %eax
  55. je ..B1.22
  56. ..B1.2:
  57. movzwl 16(%rsp), %esi
  58. andl $32767, %esi
  59. cmpl $32767, %esi
  60. je ..B1.20
  61. ..B1.3:
  62. flds -16(%rsp)
  63. fldt 8(%rsp)
  64. fucomi %st(1), %st
  65. jp ..B1.4
  66. je ..B1.23
  67. ..B1.4:
  68. fstp %st(0)
  69. movl -16(%rsp), %ecx
  70. testl $2147483647, %ecx
  71. je ..B1.19
  72. ..B1.5:
  73. fstpt -24(%rsp)
  74. movb -15(%rsp), %dl
  75. movb 17(%rsp), %al
  76. andb $-128, %dl
  77. andb $-128, %al
  78. shrb $7, %dl
  79. shrb $7, %al
  80. cmpb %dl, %al
  81. jne ..B1.11
  82. ..B1.6:
  83. movzwl -16(%rsp), %eax
  84. andl $32767, %eax
  85. cmpl %esi, %eax
  86. jg ..B1.11
  87. ..B1.7:
  88. jne ..B1.12
  89. ..B1.8:
  90. movl -20(%rsp), %eax
  91. movl 12(%rsp), %edx
  92. cmpl %edx, %eax
  93. ja ..B1.11
  94. ..B1.9:
  95. jne ..B1.12
  96. ..B1.10:
  97. movl -24(%rsp), %eax
  98. cmpl 8(%rsp), %eax
  99. jbe ..B1.12
  100. ..B1.11:
  101. decl %ecx
  102. movl %ecx, -24(%rsp)
  103. jmp ..B1.13
  104. ..B1.12:
  105. incl %ecx
  106. movl %ecx, -24(%rsp)
  107. ..B1.13:
  108. andl $2147483647, %ecx
  109. lea -8388608(%rcx), %eax
  110. cmpl $2130706432, %eax
  111. jb ..B1.18
  112. ..B1.14:
  113. cmpl $8388608, %ecx
  114. jae ..B1.16
  115. ..B1.15:
  116. movss .L_2il0floatpacket.0(%rip), %xmm1
  117. movss %xmm1, -8(%rsp)
  118. movss -8(%rsp), %xmm0
  119. mulss %xmm0, %xmm1
  120. movss -24(%rsp), %xmm0
  121. movss %xmm1, -8(%rsp)
  122. ret
  123. ..B1.16:
  124. movss .L_2il0floatpacket.1(%rip), %xmm0
  125. movss %xmm0, -8(%rsp)
  126. movss -8(%rsp), %xmm1
  127. mulss %xmm0, %xmm1
  128. movss -24(%rsp), %xmm0
  129. movss %xmm1, -8(%rsp)
  130. ..B1.17:
  131. ret
  132. ..B1.18:
  133. movss -24(%rsp), %xmm0
  134. ret
  135. ..B1.19:
  136. fstp %st(0)
  137. movb 17(%rsp), %al
  138. lea _smallest_value_32(%rip), %rdx
  139. andb $-128, %al
  140. movss .L_2il0floatpacket.0(%rip), %xmm0
  141. movss %xmm0, -8(%rsp)
  142. shrb $7, %al
  143. movss -8(%rsp), %xmm1
  144. mulss %xmm0, %xmm1
  145. movss %xmm1, -8(%rsp)
  146. movzbl %al, %ecx
  147. movl (%rdx,%rcx,4), %esi
  148. movl %esi, -24(%rsp)
  149. jmp ..B1.18
  150. ..B1.20:
  151. movq $0x8000000000000000, %rax
  152. cmpq 8(%rsp), %rax
  153. je ..B1.3
  154. ..B1.21:
  155. flds -16(%rsp)
  156. fldt 8(%rsp)
  157. fmulp %st, %st(1)
  158. fstps -24(%rsp)
  159. movss -24(%rsp), %xmm0
  160. ret
  161. ..B1.22:
  162. testl $8388607, -16(%rsp)
  163. jne ..B1.21
  164. jmp ..B1.2
  165. ..B1.23:
  166. fstp %st(1)
  167. fstps -24(%rsp)
  168. movss -24(%rsp), %xmm0
  169. ret
  170. .align 16,0x90
  171. .cfi_endproc
  172. .type nexttowardf,@function
  173. .size nexttowardf,.-nexttowardf
  174. .data
  175. # -- End nexttowardf
  176. .section .rodata, "a"
  177. .align 4
  178. .align 4
  179. .L_2il0floatpacket.0:
  180. .long 0x0d800000
  181. .type .L_2il0floatpacket.0,@object
  182. .size .L_2il0floatpacket.0,4
  183. .align 4
  184. .L_2il0floatpacket.1:
  185. .long 0x71800000
  186. .type .L_2il0floatpacket.1,@object
  187. .size .L_2il0floatpacket.1,4
  188. .align 4
  189. _smallest_value_32:
  190. .long 1
  191. .long 2147483649
  192. .type _smallest_value_32,@object
  193. .size _smallest_value_32,8
  194. .data
  195. .section .note.GNU-stack, ""
  196. // -- Begin DWARF2 SEGMENT .eh_frame
  197. .section .eh_frame,"a",@progbits
  198. .eh_frame_seg:
  199. .align 1
  200. # End