nextafterf_gen.S 5.2 KB

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