round_gen.S 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 "round_gen.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin round
  41. .text
  42. .align 16,0x90
  43. .globl round
  44. round:
  45. # parameter 1: %xmm0
  46. ..B1.1:
  47. .cfi_startproc
  48. ..___tag_value_round.1:
  49. ..L2:
  50. subq $24, %rsp
  51. .cfi_def_cfa_offset 32
  52. movsd %xmm0, (%rsp)
  53. ..B1.2:
  54. movapd bns(%rip), %xmm2
  55. movapd %xmm0, %xmm3
  56. movapd %xmm0, %xmm1
  57. psrlq $52, %xmm0
  58. movd %xmm0, %eax
  59. andpd s(%rip), %xmm0
  60. psubd %xmm0, %xmm2
  61. psrlq %xmm2, %xmm1
  62. psllq %xmm2, %xmm1
  63. testl $2048, %eax
  64. jne .L_2TAG_PACKET_0.0.1
  65. cmpl $1023, %eax
  66. jl .L_2TAG_PACKET_1.0.1
  67. cmpl $1074, %eax
  68. jg .L_2TAG_PACKET_2.0.1
  69. subsd %xmm1, %xmm3
  70. movq %xmm1, %xmm0
  71. cmppd $5, p_half(%rip), %xmm3
  72. andpd p_one(%rip), %xmm3
  73. addsd %xmm3, %xmm0
  74. jmp ..B1.4
  75. .L_2TAG_PACKET_1.0.1:
  76. cmpl $1022, %eax
  77. jl .L_2TAG_PACKET_3.0.1
  78. movq p_one(%rip), %xmm0
  79. jmp ..B1.4
  80. .L_2TAG_PACKET_3.0.1:
  81. pxor %xmm0, %xmm0
  82. jmp ..B1.4
  83. .L_2TAG_PACKET_2.0.1:
  84. movq (%rsp), %xmm0
  85. jmp ..B1.4
  86. .L_2TAG_PACKET_0.0.1:
  87. cmpl $3071, %eax
  88. jl .L_2TAG_PACKET_4.0.1
  89. cmpl $3122, %eax
  90. jg .L_2TAG_PACKET_2.0.1
  91. subsd %xmm1, %xmm3
  92. movq %xmm1, %xmm0
  93. cmppd $2, n_half(%rip), %xmm3
  94. andpd n_one(%rip), %xmm3
  95. addsd %xmm3, %xmm0
  96. jmp ..B1.4
  97. .L_2TAG_PACKET_4.0.1:
  98. cmpl $3070, %eax
  99. jl .L_2TAG_PACKET_5.0.1
  100. movq n_one(%rip), %xmm0
  101. jmp ..B1.4
  102. .L_2TAG_PACKET_5.0.1:
  103. movq 8+zeros(%rip), %xmm0
  104. movq %xmm0, 8(%rsp)
  105. .L_2TAG_PACKET_6.0.1:
  106. ..B1.4:
  107. addq $24, %rsp
  108. .cfi_def_cfa_offset 8
  109. ret
  110. .align 16,0x90
  111. .cfi_endproc
  112. .type round,@function
  113. .size round,.-round
  114. .data
  115. # -- End round
  116. .section .rodata, "a"
  117. .align 16
  118. .align 16
  119. bns:
  120. .long 1075
  121. .long 0
  122. .long 1075
  123. .long 0
  124. .type bns,@object
  125. .size bns,16
  126. .align 16
  127. s:
  128. .long 2047
  129. .long 0
  130. .long 0
  131. .long 0
  132. .type s,@object
  133. .size s,16
  134. .align 16
  135. p_half:
  136. .long 0
  137. .long 1071644672
  138. .long 0
  139. .long 1071644672
  140. .type p_half,@object
  141. .size p_half,16
  142. .align 16
  143. p_one:
  144. .long 0
  145. .long 1072693248
  146. .long 0
  147. .long 1072693248
  148. .type p_one,@object
  149. .size p_one,16
  150. .align 16
  151. n_half:
  152. .long 0
  153. .long 3219128320
  154. .long 0
  155. .long 1127219200
  156. .type n_half,@object
  157. .size n_half,16
  158. .align 16
  159. n_one:
  160. .long 0
  161. .long 3220176896
  162. .long 0
  163. .long 1127219200
  164. .type n_one,@object
  165. .size n_one,16
  166. .align 16
  167. zeros:
  168. .long 0
  169. .long 0
  170. .long 0
  171. .long 2147483648
  172. .type zeros,@object
  173. .size zeros,16
  174. .data
  175. .section .note.GNU-stack, ""
  176. // -- Begin DWARF2 SEGMENT .eh_frame
  177. .section .eh_frame,"a",@progbits
  178. .eh_frame_seg:
  179. .align 1
  180. # End