libm_normalizel_k80.S 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 "libm_normalizel_k80.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin __libm_normalizel_k80
  41. .text
  42. .align 16,0x90
  43. .hidden __libm_normalizel_k80
  44. .globl __libm_normalizel_k80
  45. __libm_normalizel_k80:
  46. # parameter 1: 16 + %esp
  47. ..B1.1:
  48. ..L1:
  49. pushl %edi
  50. pushl %ebx
  51. pushl %ebp
  52. movl 16(%esp), %ecx
  53. cmpl $0, 4(%ecx)
  54. jne ..B1.3
  55. ..B1.2:
  56. cmpl $0, (%ecx)
  57. je ..B1.14
  58. ..B1.3:
  59. movzwl 8(%ecx), %ebx
  60. movl %ebx, %eax
  61. andl $32767, %eax
  62. cmpl $32767, %eax
  63. je ..B1.14
  64. ..B1.4:
  65. call ..L2
  66. ..L2:
  67. popl %edx
  68. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx
  69. testl %eax, %eax
  70. jle ..B1.16
  71. ..B1.5:
  72. andl $-32768, %ebx
  73. addl $-16383, %eax
  74. orl $-49153, %ebx
  75. ..B1.6:
  76. movw %bx, 8(%ecx)
  77. cmpl $0, 16(%ecx)
  78. jne ..B1.8
  79. ..B1.7:
  80. cmpl $0, 12(%ecx)
  81. je ..B1.13
  82. ..B1.8:
  83. movzwl 20(%ecx), %ebp
  84. movl %ebp, %edi
  85. andl $32767, %edi
  86. jle ..B1.15
  87. ..B1.9:
  88. andl $-32768, %ebp
  89. addl $-16383, %edi
  90. orl $-49153, %ebp
  91. ..B1.10:
  92. lea -256(%eax), %ebx
  93. cmpl %ebx, %edi
  94. jle ..B1.12
  95. ..B1.11:
  96. subl %eax, %edi
  97. andl $-32768, %ebp
  98. addl $16383, %edi
  99. andl $32767, %edi
  100. orl %edi, %ebp
  101. movw %bp, 20(%ecx)
  102. jmp ..B1.13
  103. ..B1.12:
  104. fldt _CONSTANTS@GOTOFF(%edx)
  105. fstpt 12(%ecx)
  106. ..B1.13:
  107. addl %eax, 24(%ecx)
  108. ..B1.14:
  109. popl %ebp
  110. popl %ebx
  111. popl %edi
  112. ret
  113. ..B1.15:
  114. fldt 12(%ecx)
  115. fldt 12+_CONSTANTS@GOTOFF(%edx)
  116. fmulp %st, %st(1)
  117. fstpt 12(%ecx)
  118. movzwl 20(%ecx), %ebp
  119. movl %ebp, %edi
  120. andl $32767, %edi
  121. andl $-32768, %ebp
  122. addl $-16639, %edi
  123. orl $-49153, %ebp
  124. jmp ..B1.10
  125. ..B1.16:
  126. fldt (%ecx)
  127. fldt 12+_CONSTANTS@GOTOFF(%edx)
  128. fmulp %st, %st(1)
  129. fstpt (%ecx)
  130. movzwl 8(%ecx), %ebx
  131. movl %ebx, %eax
  132. andl $32767, %eax
  133. andl $-32768, %ebx
  134. addl $-16639, %eax
  135. orl $-49153, %ebx
  136. jmp ..B1.6
  137. .align 16,0x90
  138. .type __libm_normalizel_k80,@function
  139. .size __libm_normalizel_k80,.-__libm_normalizel_k80
  140. .data
  141. # -- End __libm_normalizel_k80
  142. .section .rodata, "a"
  143. .align 16
  144. .align 16
  145. _CONSTANTS:
  146. .word 0
  147. .word 0
  148. .word 0
  149. .word 0
  150. .word 0
  151. .word 0
  152. .word 0
  153. .word 0
  154. .word 0
  155. .word 32768
  156. .word 16639
  157. .word 0
  158. .type _CONSTANTS,@object
  159. .size _CONSTANTS,24
  160. .data
  161. .section .note.GNU-stack, ""
  162. # End