scalbln_gen.S 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 "scalbln_gen.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin scalbln
  41. .text
  42. .align 16,0x90
  43. .globl scalbln
  44. scalbln:
  45. # parameter 1: %xmm0
  46. # parameter 2: %rdi
  47. ..B1.1:
  48. .cfi_startproc
  49. ..___tag_value_scalbln.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. cmpq $65536, %rdi
  85. cmovg %rax, %rdi
  86. movq $-65536, %rdx
  87. cmpq $-65536, %rdi
  88. movslq %ecx, %rcx
  89. cmovl %rdx, %rdi
  90. addq %rdi, %rcx
  91. testl %ecx, %ecx
  92. jle ..B1.12
  93. ..B1.8:
  94. cmpl $2047, %ecx
  95. jge ..B1.11
  96. ..B1.9:
  97. andl $2047, %ecx
  98. andl $-32753, %esi
  99. shll $4, %ecx
  100. orl %ecx, %esi
  101. movw %si, -2(%rsp)
  102. movsd -8(%rsp), %xmm0
  103. ..B1.10:
  104. ret
  105. ..B1.11:
  106. movb -1(%rsp), %al
  107. lea _large_value_64(%rip), %rcx
  108. andb $-128, %al
  109. shrb $7, %al
  110. movzbl %al, %edx
  111. movsd (%rcx,%rdx,8), %xmm0
  112. mulsd (%rcx), %xmm0
  113. ret
  114. ..B1.12:
  115. cmpl $-52, %ecx
  116. jl ..B1.16
  117. ..B1.13:
  118. addl $55, %ecx
  119. lea 8+_TWO_55(%rip), %rax
  120. andl $2047, %ecx
  121. andl $-32753, %esi
  122. shll $4, %ecx
  123. orl %ecx, %esi
  124. movw %si, -2(%rsp)
  125. testb %r8b, %r8b
  126. movsd -8(%rsp), %xmm0
  127. mulsd (%rax), %xmm0
  128. je ..B1.15
  129. ..B1.14:
  130. testq %rdi, %rdi
  131. jl ..B1.10
  132. ..B1.15:
  133. ret
  134. ..B1.16:
  135. movb -1(%rsp), %al
  136. lea _small_value_64(%rip), %rcx
  137. andb $-128, %al
  138. shrb $7, %al
  139. movzbl %al, %edx
  140. movsd (%rcx,%rdx,8), %xmm0
  141. mulsd (%rcx), %xmm0
  142. ret
  143. ..B1.17:
  144. lea _ones(%rip), %rax
  145. movsd -8(%rsp), %xmm0
  146. mulsd (%rax), %xmm0
  147. ret
  148. .align 16,0x90
  149. .cfi_endproc
  150. .type scalbln,@function
  151. .size scalbln,.-scalbln
  152. .data
  153. # -- End scalbln
  154. .section .rodata, "a"
  155. .align 4
  156. .align 4
  157. _TWO_55:
  158. .long 0
  159. .long 1130364928
  160. .long 0
  161. .long 1015021568
  162. .type _TWO_55,@object
  163. .size _TWO_55,16
  164. .align 4
  165. _large_value_64:
  166. .long 0
  167. .long 2121269248
  168. .long 0
  169. .long 4268752896
  170. .type _large_value_64,@object
  171. .size _large_value_64,16
  172. .align 4
  173. _small_value_64:
  174. .long 0
  175. .long 24117248
  176. .long 0
  177. .long 2171600896
  178. .type _small_value_64,@object
  179. .size _small_value_64,16
  180. .align 4
  181. _ones:
  182. .long 0
  183. .long 1072693248
  184. .long 0
  185. .long 3220176896
  186. .type _ones,@object
  187. .size _ones,16
  188. .data
  189. .section .note.GNU-stack, ""
  190. // -- Begin DWARF2 SEGMENT .eh_frame
  191. .section .eh_frame,"a",@progbits
  192. .eh_frame_seg:
  193. .align 1
  194. # End