ceil_gen.S 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 "ceil_gen.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin ceil
  41. .text
  42. .align 16,0x90
  43. .globl ceil
  44. ceil:
  45. # parameter 1: %xmm0
  46. ..B1.1:
  47. .cfi_startproc
  48. ..___tag_value_ceil.1:
  49. ..L2:
  50. movsd %xmm0, -8(%rsp)
  51. movl -4(%rsp), %eax
  52. movl %eax, %edi
  53. andl $2147483647, %edi
  54. lea -1072693248(%rdi), %edx
  55. cmpl $54525952, %edx
  56. jae ..B1.12
  57. ..B1.2:
  58. movl %edi, %ecx
  59. shrl $20, %ecx
  60. cmpl $22020096, %edx
  61. jae ..B1.8
  62. ..B1.3:
  63. negl %ecx
  64. movl $-1, %esi
  65. addl $19, %ecx
  66. shll %cl, %esi
  67. movl %esi, %edx
  68. andl %esi, %eax
  69. notl %edx
  70. andl %edx, %edi
  71. orl -8(%rsp), %edi
  72. movl $0, -8(%rsp)
  73. testl $-2147483648, %eax
  74. jne ..B1.6
  75. ..B1.4:
  76. testl %edi, %edi
  77. je ..B1.6
  78. ..B1.5:
  79. subl %esi, %eax
  80. movl %eax, -4(%rsp)
  81. jmp ..B1.11
  82. ..B1.6:
  83. movl %eax, -4(%rsp)
  84. jmp ..B1.11
  85. ..B1.8:
  86. negl %ecx
  87. movl $-1, %esi
  88. addl $19, %ecx
  89. shll %cl, %esi
  90. movl %esi, %ecx
  91. notl %ecx
  92. movl -8(%rsp), %edx
  93. andl %edx, %ecx
  94. andl %esi, %edx
  95. movl %edx, -8(%rsp)
  96. testl $-2147483648, %eax
  97. jne ..B1.11
  98. ..B1.9:
  99. testl %ecx, %ecx
  100. je ..B1.11
  101. ..B1.10:
  102. movl -4(%rsp), %eax
  103. shlq $32, %rax
  104. movslq %esi, %rsi
  105. orq %rdx, %rax
  106. subq %rsi, %rax
  107. movq %rax, -8(%rsp)
  108. ..B1.11:
  109. movsd -8(%rsp), %xmm0
  110. ret
  111. ..B1.12:
  112. testl $-2147483648, %edx
  113. je ..B1.17
  114. ..B1.13:
  115. movl -8(%rsp), %edx
  116. orl %edx, %edi
  117. jne ..B1.15
  118. ..B1.14:
  119. movsd -8(%rsp), %xmm0
  120. ret
  121. ..B1.15:
  122. lea _pone_nzero(%rip), %rdx
  123. shrl $31, %eax
  124. movsd (%rdx,%rax,8), %xmm0
  125. ..B1.16:
  126. ret
  127. ..B1.17:
  128. movsd -8(%rsp), %xmm0
  129. cmpl $1073741824, %edx
  130. jb ..B1.20
  131. ..B1.19:
  132. lea _ones(%rip), %rax
  133. mulsd (%rax), %xmm0
  134. ..B1.20:
  135. ret
  136. .align 16,0x90
  137. .cfi_endproc
  138. .type ceil,@function
  139. .size ceil,.-ceil
  140. .data
  141. # -- End ceil
  142. .section .rodata, "a"
  143. .align 4
  144. .align 4
  145. _pone_nzero:
  146. .long 0
  147. .long 1072693248
  148. .long 0
  149. .long 2147483648
  150. .type _pone_nzero,@object
  151. .size _pone_nzero,16
  152. .align 4
  153. _ones:
  154. .long 0
  155. .long 1072693248
  156. .long 0
  157. .long 3220176896
  158. .type _ones,@object
  159. .size _ones,16
  160. .data
  161. .section .note.GNU-stack, ""
  162. // -- Begin DWARF2 SEGMENT .eh_frame
  163. .section .eh_frame,"a",@progbits
  164. .eh_frame_seg:
  165. .align 1
  166. # End