scalbn_gen.S 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 "scalbn_gen.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin scalbn
  41. .text
  42. .align 16,0x90
  43. .globl scalbn
  44. scalbn:
  45. # parameter 1: %xmm0
  46. # parameter 2: %edi
  47. ..B1.1:
  48. .cfi_startproc
  49. ..___tag_value_scalbn.1:
  50. ..L2:
  51. movsd %xmm0, -8(%rsp)
  52. movzwl -2(%rsp), %esi
  53. movl %esi, %ecx
  54. andl $32752, %ecx
  55. shrl $4, %ecx
  56. cmpl $2047, %ecx
  57. je ..B1.17
  58. ..B1.2:
  59. xorb %r8b, %r8b
  60. testl %ecx, %ecx
  61. jne ..B1.7
  62. ..B1.3:
  63. testl $1048575, -4(%rsp)
  64. jne ..B1.6
  65. ..B1.4:
  66. cmpl $0, -8(%rsp)
  67. jne ..B1.6
  68. ..B1.5:
  69. movsd -8(%rsp), %xmm0
  70. ret
  71. ..B1.6:
  72. lea _TWO_55(%rip), %rax
  73. movb $1, %r8b
  74. movsd -8(%rsp), %xmm0
  75. mulsd (%rax), %xmm0
  76. movsd %xmm0, -8(%rsp)
  77. movzwl -2(%rsp), %esi
  78. movl %esi, %ecx
  79. andl $32752, %ecx
  80. shrl $4, %ecx
  81. addl $-55, %ecx
  82. ..B1.7:
  83. movl $65536, %eax
  84. cmpl $65536, %edi
  85. cmovg %eax, %edi
  86. movl $-65536, %edx
  87. cmpl $-65536, %edi
  88. cmovle %edx, %edi
  89. lea (%rcx,%rdi), %eax
  90. testl %eax, %eax
  91. jle ..B1.12
  92. ..B1.8:
  93. cmpl $2047, %eax
  94. jge ..B1.11
  95. ..B1.9:
  96. andl $2047, %eax
  97. andl $-32753, %esi
  98. shll $4, %eax
  99. orl %eax, %esi
  100. movw %si, -2(%rsp)
  101. movsd -8(%rsp), %xmm0
  102. ..B1.10:
  103. ret
  104. ..B1.11:
  105. movb -1(%rsp), %al
  106. lea _large_value_64(%rip), %rcx
  107. andb $-128, %al
  108. shrb $7, %al
  109. movzbl %al, %edx
  110. movsd (%rcx,%rdx,8), %xmm0
  111. mulsd (%rcx), %xmm0
  112. ret
  113. ..B1.12:
  114. cmpl $-52, %eax
  115. jl ..B1.16
  116. ..B1.13:
  117. lea 8+_TWO_55(%rip), %rdx
  118. lea 55(%rcx,%rdi), %eax
  119. andl $2047, %eax
  120. andl $-32753, %esi
  121. shll $4, %eax
  122. orl %eax, %esi
  123. movw %si, -2(%rsp)
  124. testb %r8b, %r8b
  125. movsd -8(%rsp), %xmm0
  126. mulsd (%rdx), %xmm0
  127. je ..B1.15
  128. ..B1.14:
  129. testl %edi, %edi
  130. jl ..B1.10
  131. ..B1.15:
  132. ret
  133. ..B1.16:
  134. movb -1(%rsp), %al
  135. lea _small_value_64(%rip), %rcx
  136. andb $-128, %al
  137. shrb $7, %al
  138. movzbl %al, %edx
  139. movsd (%rcx,%rdx,8), %xmm0
  140. mulsd (%rcx), %xmm0
  141. ret
  142. ..B1.17:
  143. lea _ones(%rip), %rax
  144. movsd -8(%rsp), %xmm0
  145. mulsd (%rax), %xmm0
  146. ret
  147. .align 16,0x90
  148. .cfi_endproc
  149. .type scalbn,@function
  150. .size scalbn,.-scalbn
  151. .data
  152. # -- End scalbn
  153. .section .rodata, "a"
  154. .align 4
  155. .align 4
  156. _TWO_55:
  157. .long 0
  158. .long 1130364928
  159. .long 0
  160. .long 1015021568
  161. .type _TWO_55,@object
  162. .size _TWO_55,16
  163. .align 4
  164. _large_value_64:
  165. .long 0
  166. .long 2121269248
  167. .long 0
  168. .long 4268752896
  169. .type _large_value_64,@object
  170. .size _large_value_64,16
  171. .align 4
  172. _small_value_64:
  173. .long 0
  174. .long 24117248
  175. .long 0
  176. .long 2171600896
  177. .type _small_value_64,@object
  178. .size _small_value_64,16
  179. .align 4
  180. _ones:
  181. .long 0
  182. .long 1072693248
  183. .long 0
  184. .long 3220176896
  185. .type _ones,@object
  186. .size _ones,16
  187. .data
  188. .section .note.GNU-stack, ""
  189. // -- Begin DWARF2 SEGMENT .eh_frame
  190. .section .eh_frame,"a",@progbits
  191. .eh_frame_seg:
  192. .align 1
  193. # End