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