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.

axpy.S 4.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 M ARG1 /* rdi */
  41. #define X ARG4 /* rsi */
  42. #define INCX ARG5 /* rdx */
  43. #define Y ARG6 /* rcx */
  44. #define INCY ARG2 /* r8 */
  45. #define ALPHA 8(%rsp)
  46. #include "l1param.h"
  47. PROLOGUE
  48. PROFCODE
  49. movq 24(%rsp), INCY
  50. FLD ALPHA
  51. salq $BASE_SHIFT, INCX
  52. salq $BASE_SHIFT, INCY
  53. testq M, M
  54. jle .L40
  55. cmpq $SIZE, INCX
  56. jne .L14
  57. cmpq $SIZE, INCY
  58. jne .L14
  59. movq M, %rax
  60. sarq $3, %rax
  61. jle .L15
  62. ALIGN_3
  63. #define PRESIZE 33
  64. .L16:
  65. #ifdef PREFETCH
  66. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  67. #endif
  68. FLD 0 * SIZE(X)
  69. fmul %st(1),%st
  70. FLD 0 * SIZE(Y)
  71. faddp %st, %st(1)
  72. FST 0 * SIZE(Y)
  73. FLD 1 * SIZE(X)
  74. fmul %st(1),%st
  75. FLD 1 * SIZE(Y)
  76. faddp %st, %st(1)
  77. FST 1 * SIZE(Y)
  78. FLD 2 * SIZE(X)
  79. fmul %st(1),%st
  80. FLD 2 * SIZE(Y)
  81. faddp %st, %st(1)
  82. FST 2 * SIZE(Y)
  83. FLD 3 * SIZE(X)
  84. fmul %st(1),%st
  85. FLD 3 * SIZE(Y)
  86. faddp %st, %st(1)
  87. FST 3 * SIZE(Y)
  88. #ifdef PREFETCHW
  89. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(Y)
  90. #endif
  91. FLD 4 * SIZE(X)
  92. fmul %st(1),%st
  93. FLD 4 * SIZE(Y)
  94. faddp %st, %st(1)
  95. FST 4 * SIZE(Y)
  96. FLD 5 * SIZE(X)
  97. fmul %st(1),%st
  98. FLD 5 * SIZE(Y)
  99. faddp %st, %st(1)
  100. FST 5 * SIZE(Y)
  101. FLD 6 * SIZE(X)
  102. fmul %st(1),%st
  103. FLD 6 * SIZE(Y)
  104. faddp %st, %st(1)
  105. FST 6 * SIZE(Y)
  106. FLD 7 * SIZE(X)
  107. fmul %st(1),%st
  108. FLD 7 * SIZE(Y)
  109. faddp %st, %st(1)
  110. FST 7 * SIZE(Y)
  111. addq $8 * SIZE, X
  112. addq $8 * SIZE, Y
  113. decq %rax
  114. jg .L16
  115. ALIGN_3
  116. .L15:
  117. movq M, %rax
  118. andq $7, %rax
  119. jle .L40
  120. ALIGN_3
  121. .L22:
  122. FLD 0 * SIZE(X)
  123. fmul %st(1),%st
  124. FLD 0 * SIZE(Y)
  125. faddp %st, %st(1)
  126. FST 0 * SIZE(Y)
  127. addq $SIZE, X
  128. addq $SIZE, Y
  129. decq %rax
  130. jg .L22
  131. jmp .L40
  132. ALIGN_3
  133. .L14:
  134. movq M, %rax
  135. sarq $2, %rax
  136. jle .L28
  137. ALIGN_3
  138. .L29:
  139. FLD (X)
  140. fmul %st(1),%st
  141. FLD (Y)
  142. faddp %st, %st(1)
  143. FST (Y)
  144. addq INCX, X
  145. addq INCY, Y
  146. FLD (X)
  147. fmul %st(1),%st
  148. FLD (Y)
  149. faddp %st, %st(1)
  150. FST (Y)
  151. addq INCX, X
  152. addq INCY, Y
  153. FLD (X)
  154. fmul %st(1),%st
  155. FLD (Y)
  156. faddp %st, %st(1)
  157. FST (Y)
  158. addq INCX, X
  159. addq INCY, Y
  160. FLD (X)
  161. fmul %st(1),%st
  162. FLD (Y)
  163. faddp %st, %st(1)
  164. FST (Y)
  165. addq INCX, X
  166. addq INCY, Y
  167. decq %rax
  168. jg .L29
  169. ALIGN_3
  170. .L28:
  171. movq M, %rax
  172. andq $3, %rax
  173. jle .L40
  174. ALIGN_3
  175. .L35:
  176. FLD (X)
  177. fmul %st(1),%st
  178. FLD (Y)
  179. faddp %st, %st(1)
  180. FST (Y)
  181. addq INCX, X
  182. addq INCY, Y
  183. decq %rax
  184. jg .L35
  185. .L40:
  186. ffreep %st(0)
  187. ret
  188. EPILOGUE