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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 STACK 12
  41. #define ARGS 0
  42. #define STACK_N 4 + STACK + ARGS(%esp)
  43. #define STACK_X 8 + STACK + ARGS(%esp)
  44. #define STACK_INCX 12 + STACK + ARGS(%esp)
  45. #define STACK_Y 16 + STACK + ARGS(%esp)
  46. #define STACK_INCY 20 + STACK + ARGS(%esp)
  47. #define N %ebx
  48. #define X %esi
  49. #define INCX %ecx
  50. #define Y %edi
  51. #define INCY %edx
  52. #include "l1param.h"
  53. PROLOGUE
  54. #ifdef WINDOWS_ABI
  55. emms
  56. #endif
  57. pushl %edi
  58. pushl %esi
  59. pushl %ebx
  60. PROFCODE
  61. movl STACK_N, N
  62. movl STACK_X, X
  63. movl STACK_INCX, INCX
  64. movl STACK_Y, Y
  65. movl STACK_INCY, INCY
  66. sall $BASE_SHIFT, INCX
  67. sall $BASE_SHIFT, INCY
  68. fldz
  69. fldz
  70. fldz
  71. fldz
  72. cmpl $SIZE, INCX
  73. jne .L14
  74. cmpl $SIZE, INCY
  75. jne .L14
  76. movl N, %eax
  77. sarl $2, %eax
  78. jle .L15
  79. ALIGN_3
  80. .L16:
  81. #ifdef PREFETCHW
  82. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  83. #endif
  84. FLD 0 * SIZE(X)
  85. FLD 0 * SIZE(Y)
  86. fmulp %st, %st(1)
  87. faddp %st,%st(1)
  88. FLD 1 * SIZE(X)
  89. FLD 1 * SIZE(Y)
  90. fmulp %st, %st(1)
  91. faddp %st,%st(2)
  92. #ifdef PREFETCHW
  93. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(Y)
  94. #endif
  95. FLD 2 * SIZE(X)
  96. FLD 2 * SIZE(Y)
  97. fmulp %st, %st(1)
  98. faddp %st,%st(3)
  99. FLD 3 * SIZE(X)
  100. FLD 3 * SIZE(Y)
  101. fmulp %st, %st(1)
  102. faddp %st,%st(4)
  103. addl $4 * SIZE, X
  104. addl $4 * SIZE, Y
  105. decl %eax
  106. jg .L16
  107. ALIGN_3
  108. .L15:
  109. movl N, %eax
  110. andl $3, %eax
  111. jle .L27
  112. ALIGN_3
  113. .L22:
  114. FLD (X)
  115. addl $SIZE, X
  116. FLD (Y)
  117. fmulp %st, %st(1)
  118. addl $SIZE, Y
  119. faddp %st,%st(1)
  120. decl %eax
  121. jg .L22
  122. jmp .L27
  123. ALIGN_3
  124. .L14:
  125. movl N, %eax
  126. sarl $2, %eax
  127. jle .L30
  128. ALIGN_3
  129. .L31:
  130. FLD (X)
  131. addl INCX, X
  132. FLD (Y)
  133. fmulp %st, %st(1)
  134. addl INCY, Y
  135. faddp %st,%st(1)
  136. FLD (X)
  137. addl INCX, X
  138. FLD (Y)
  139. fmulp %st, %st(1)
  140. addl INCY, Y
  141. faddp %st,%st(2)
  142. FLD (X)
  143. addl INCX, X
  144. FLD (Y)
  145. fmulp %st, %st(1)
  146. addl INCY, Y
  147. faddp %st,%st(3)
  148. FLD (X)
  149. addl INCX, X
  150. FLD (Y)
  151. fmulp %st, %st(1)
  152. addl INCY, Y
  153. faddp %st,%st(4)
  154. decl %eax
  155. jg .L31
  156. ALIGN_3
  157. .L30:
  158. movl N, %eax
  159. andl $3, %eax
  160. jle .L27
  161. ALIGN_3
  162. .L37:
  163. FLD (X)
  164. addl INCX, X
  165. FLD (Y)
  166. fmulp %st, %st(1)
  167. addl INCY, Y
  168. faddp %st, %st(1)
  169. decl %eax
  170. jg .L37
  171. ALIGN_3
  172. .L27:
  173. faddp %st,%st(2)
  174. faddp %st,%st(2)
  175. faddp %st,%st(1)
  176. popl %ebx
  177. popl %esi
  178. popl %edi
  179. ret
  180. EPILOGUE