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.

qdot.S 4.8 kB

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