ldexpf.S 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 "ldexpf.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin ldexpf
  41. .text
  42. .align 16,0x90
  43. .globl ldexpf
  44. ldexpf:
  45. # parameter 1: %xmm0
  46. # parameter 2: %edi
  47. ..B1.1:
  48. .cfi_startproc
  49. ..___tag_value_ldexpf.1:
  50. ..L2:
  51. movl %edi, %r8d
  52. movss %xmm0, -8(%rsp)
  53. movzwl -6(%rsp), %eax
  54. movl %eax, %esi
  55. andl $32640, %esi
  56. shrl $7, %esi
  57. cmpl $255, %esi
  58. je ..B1.9
  59. ..B1.2:
  60. xorb %dil, %dil
  61. testl %esi, %esi
  62. jne ..B1.5
  63. ..B1.3:
  64. testl $8388607, -8(%rsp)
  65. je ..B1.9
  66. ..B1.4:
  67. movss -8(%rsp), %xmm0
  68. movb $1, %dil
  69. mulss .L_2il0floatpacket.0(%rip), %xmm0
  70. movss %xmm0, -8(%rsp)
  71. movzwl -6(%rsp), %eax
  72. movl %eax, %esi
  73. andl $32640, %esi
  74. shrl $7, %esi
  75. addl $-25, %esi
  76. ..B1.5:
  77. movl $65536, %edx
  78. cmpl $65536, %r8d
  79. cmovg %edx, %r8d
  80. movl $-65536, %ecx
  81. cmpl $-65536, %r8d
  82. cmovle %ecx, %r8d
  83. lea (%rsi,%r8), %edx
  84. testl %edx, %edx
  85. jle ..B1.11
  86. ..B1.6:
  87. cmpl $255, %edx
  88. jge ..B1.10
  89. ..B1.7:
  90. movzbl %dl, %edx
  91. andl $-32641, %eax
  92. shll $7, %edx
  93. orl %edx, %eax
  94. movw %ax, -6(%rsp)
  95. movss -8(%rsp), %xmm0
  96. ..B1.8:
  97. ret
  98. ..B1.9:
  99. movss -8(%rsp), %xmm0
  100. ret
  101. ..B1.10:
  102. movb -5(%rsp), %al
  103. lea _large_value_32(%rip), %rdx
  104. andb $-128, %al
  105. shrb $7, %al
  106. movzbl %al, %ecx
  107. movss (%rdx,%rcx,4), %xmm0
  108. mulss .L_2il0floatpacket.1(%rip), %xmm0
  109. ret
  110. ..B1.11:
  111. cmpl $-23, %edx
  112. jl ..B1.15
  113. ..B1.12:
  114. andl $-32641, %eax
  115. lea 25(%rsi,%r8), %edx
  116. movzbl %dl, %edx
  117. shll $7, %edx
  118. orl %edx, %eax
  119. movw %ax, -6(%rsp)
  120. testb %dil, %dil
  121. movss -8(%rsp), %xmm0
  122. mulss .L_2il0floatpacket.3(%rip), %xmm0
  123. je ..B1.14
  124. ..B1.13:
  125. testl %r8d, %r8d
  126. jl ..B1.8
  127. ..B1.14:
  128. ret
  129. ..B1.15:
  130. movb -5(%rsp), %al
  131. lea _small_value_32(%rip), %rdx
  132. andb $-128, %al
  133. shrb $7, %al
  134. movzbl %al, %ecx
  135. movss (%rdx,%rcx,4), %xmm0
  136. mulss .L_2il0floatpacket.2(%rip), %xmm0
  137. ret
  138. .align 16,0x90
  139. .cfi_endproc
  140. .type ldexpf,@function
  141. .size ldexpf,.-ldexpf
  142. .data
  143. # -- End ldexpf
  144. .section .rodata, "a"
  145. .align 4
  146. .align 4
  147. .L_2il0floatpacket.0:
  148. .long 0x4c000000
  149. .type .L_2il0floatpacket.0,@object
  150. .size .L_2il0floatpacket.0,4
  151. .align 4
  152. .L_2il0floatpacket.1:
  153. .long 0x71800000
  154. .type .L_2il0floatpacket.1,@object
  155. .size .L_2il0floatpacket.1,4
  156. .align 4
  157. .L_2il0floatpacket.2:
  158. .long 0x0d800000
  159. .type .L_2il0floatpacket.2,@object
  160. .size .L_2il0floatpacket.2,4
  161. .align 4
  162. .L_2il0floatpacket.3:
  163. .long 0x33000000
  164. .type .L_2il0floatpacket.3,@object
  165. .size .L_2il0floatpacket.3,4
  166. .align 4
  167. _large_value_32:
  168. .long 1904214016
  169. .long 4051697664
  170. .type _large_value_32,@object
  171. .size _large_value_32,8
  172. .align 4
  173. _small_value_32:
  174. .long 226492416
  175. .long 2373976064
  176. .type _small_value_32,@object
  177. .size _small_value_32,8
  178. .data
  179. .section .note.GNU-stack, ""
  180. // -- Begin DWARF2 SEGMENT .eh_frame
  181. .section .eh_frame,"a",@progbits
  182. .eh_frame_seg:
  183. .align 1
  184. # End