You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dot.S 4.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #define ASSEMBLER
  39. #include "common.h"
  40. #define N ARG1 /* rdi */
  41. #define X ARG2 /* rsi */
  42. #define INCX ARG3 /* rdx */
  43. #define Y ARG4 /* rcx */
  44. #define INCY ARG5 /* r8 */
  45. #include "l1param.h"
  46. PROLOGUE
  47. PROFCODE
  48. #ifdef WINDOWS_ABI
  49. emms
  50. #endif
  51. salq $BASE_SHIFT, INCX
  52. salq $BASE_SHIFT, INCY
  53. fldz
  54. fldz
  55. fldz
  56. fldz
  57. cmpq $SIZE, INCX
  58. jne .L14
  59. cmpq $SIZE, INCY
  60. jne .L14
  61. movq N, %rax
  62. sarq $2, %rax
  63. jle .L15
  64. ALIGN_3
  65. .L16:
  66. #ifdef PREFETCH
  67. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  68. #endif
  69. FLD 0 * SIZE(X)
  70. FLD 0 * SIZE(Y)
  71. fmulp %st, %st(1)
  72. faddp %st,%st(1)
  73. FLD 1 * SIZE(X)
  74. FLD 1 * SIZE(Y)
  75. fmulp %st, %st(1)
  76. faddp %st,%st(2)
  77. #ifdef PREFETCH
  78. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(Y)
  79. #endif
  80. FLD 2 * SIZE(X)
  81. FLD 2 * SIZE(Y)
  82. fmulp %st, %st(1)
  83. faddp %st,%st(3)
  84. FLD 3 * SIZE(X)
  85. FLD 3 * SIZE(Y)
  86. fmulp %st, %st(1)
  87. faddp %st,%st(4)
  88. addq $4 * SIZE, X
  89. addq $4 * SIZE, Y
  90. decq %rax
  91. jg .L16
  92. ALIGN_3
  93. .L15:
  94. movq N, %rax
  95. andq $3, %rax
  96. jle .L27
  97. ALIGN_3
  98. .L22:
  99. FLD (X)
  100. addq $SIZE, X
  101. FLD (Y)
  102. fmulp %st, %st(1)
  103. addq $SIZE, Y
  104. faddp %st,%st(1)
  105. decq %rax
  106. jg .L22
  107. jmp .L27
  108. ALIGN_3
  109. .L14:
  110. movq N, %rax
  111. sarq $2, %rax
  112. jle .L30
  113. ALIGN_3
  114. .L31:
  115. FLD (X)
  116. addq INCX, X
  117. FLD (Y)
  118. fmulp %st, %st(1)
  119. addq INCY, Y
  120. faddp %st,%st(1)
  121. FLD (X)
  122. addq INCX, X
  123. FLD (Y)
  124. fmulp %st, %st(1)
  125. addq INCY, Y
  126. faddp %st,%st(2)
  127. FLD (X)
  128. addq INCX, X
  129. FLD (Y)
  130. fmulp %st, %st(1)
  131. addq INCY, Y
  132. faddp %st,%st(3)
  133. FLD (X)
  134. addq INCX, X
  135. FLD (Y)
  136. fmulp %st, %st(1)
  137. addq INCY, Y
  138. faddp %st,%st(4)
  139. decq %rax
  140. jg .L31
  141. ALIGN_3
  142. .L30:
  143. movq N, %rax
  144. andq $3, %rax
  145. jle .L27
  146. ALIGN_3
  147. .L37:
  148. FLD (X)
  149. addq INCX, X
  150. FLD (Y)
  151. fmulp %st, %st(1)
  152. addq INCY, Y
  153. faddp %st, %st(1)
  154. decq %rax
  155. jg .L37
  156. ALIGN_3
  157. .L27:
  158. faddp %st,%st(2)
  159. faddp %st,%st(2)
  160. faddp %st,%st(1)
  161. ret
  162. EPILOGUE