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.

qaxpy.S 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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_M 4 + STACK + ARGS(%esp)
  43. #define STACK_ALPHA 16 + STACK + ARGS(%esp)
  44. #define STACK_X 32 + STACK + ARGS(%esp)
  45. #define STACK_INCX 36 + STACK + ARGS(%esp)
  46. #define STACK_Y 40 + STACK + ARGS(%esp)
  47. #define STACK_INCY 44 + STACK + ARGS(%esp)
  48. #define M %ebx
  49. #define X %esi
  50. #define INCX %ecx
  51. #define Y %edi
  52. #define INCY %edx
  53. PROLOGUE
  54. pushl %edi
  55. pushl %esi
  56. pushl %ebx
  57. PROFCODE
  58. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  59. EMMS
  60. #endif
  61. FLD STACK_ALPHA
  62. movl STACK_M, M
  63. movl STACK_X, X
  64. movl STACK_INCX, INCX
  65. movl STACK_Y, Y
  66. movl STACK_INCY, INCY
  67. sall $BASE_SHIFT, INCX
  68. sall $BASE_SHIFT, INCY
  69. testl M, M
  70. jle .L40
  71. cmpl $SIZE, INCX
  72. jne .L14
  73. cmpl $SIZE, INCY
  74. jne .L14
  75. movl M, %eax
  76. sarl $3, %eax
  77. jle .L15
  78. ALIGN_3
  79. #define PRESIZE 33
  80. .L16:
  81. #ifdef HAS_PREFETCH
  82. prefetcht0 PRESIZE * SIZE(X)
  83. #endif
  84. FLD 0 * SIZE(X)
  85. fmul %st(1),%st
  86. FLD 0 * SIZE(Y)
  87. faddp %st, %st(1)
  88. FST 0 * SIZE(Y)
  89. FLD 1 * SIZE(X)
  90. fmul %st(1),%st
  91. FLD 1 * SIZE(Y)
  92. faddp %st, %st(1)
  93. FST 1 * SIZE(Y)
  94. FLD 2 * SIZE(X)
  95. fmul %st(1),%st
  96. FLD 2 * SIZE(Y)
  97. faddp %st, %st(1)
  98. FST 2 * SIZE(Y)
  99. FLD 3 * SIZE(X)
  100. fmul %st(1),%st
  101. FLD 3 * SIZE(Y)
  102. faddp %st, %st(1)
  103. FST 3 * SIZE(Y)
  104. #ifdef HAS_PREFETCH
  105. prefetcht0 (4 + PRESIZE) * SIZE(X)
  106. #endif
  107. FLD 4 * SIZE(X)
  108. fmul %st(1),%st
  109. FLD 4 * SIZE(Y)
  110. faddp %st, %st(1)
  111. FST 4 * SIZE(Y)
  112. FLD 5 * SIZE(X)
  113. fmul %st(1),%st
  114. FLD 5 * SIZE(Y)
  115. faddp %st, %st(1)
  116. FST 5 * SIZE(Y)
  117. FLD 6 * SIZE(X)
  118. fmul %st(1),%st
  119. FLD 6 * SIZE(Y)
  120. faddp %st, %st(1)
  121. FST 6 * SIZE(Y)
  122. FLD 7 * SIZE(X)
  123. fmul %st(1),%st
  124. FLD 7 * SIZE(Y)
  125. faddp %st, %st(1)
  126. FST 7 * SIZE(Y)
  127. #ifdef HAVE_3DNOW
  128. prefetchw 24 * SIZE(Y)
  129. #endif
  130. addl $8 * SIZE, X
  131. addl $8 * SIZE, Y
  132. decl %eax
  133. jg .L16
  134. ALIGN_3
  135. .L15:
  136. movl M, %eax
  137. andl $7, %eax
  138. jle .L40
  139. ALIGN_3
  140. .L22:
  141. FLD 0 * SIZE(X)
  142. fmul %st(1),%st
  143. FLD 0 * SIZE(Y)
  144. faddp %st, %st(1)
  145. FST 0 * SIZE(Y)
  146. addl $SIZE, X
  147. addl $SIZE, Y
  148. decl %eax
  149. jg .L22
  150. jmp .L40
  151. ALIGN_3
  152. .L14:
  153. movl M, %eax
  154. sarl $2, %eax
  155. jle .L28
  156. ALIGN_3
  157. .L29:
  158. FLD (X)
  159. fmul %st(1),%st
  160. FLD (Y)
  161. faddp %st, %st(1)
  162. FST (Y)
  163. addl INCX, X
  164. addl INCY, Y
  165. FLD (X)
  166. fmul %st(1),%st
  167. FLD (Y)
  168. faddp %st, %st(1)
  169. FST (Y)
  170. addl INCX, X
  171. addl INCY, Y
  172. FLD (X)
  173. fmul %st(1),%st
  174. FLD (Y)
  175. faddp %st, %st(1)
  176. FST (Y)
  177. addl INCX, X
  178. addl INCY, Y
  179. FLD (X)
  180. fmul %st(1),%st
  181. FLD (Y)
  182. faddp %st, %st(1)
  183. FST (Y)
  184. addl INCX, X
  185. addl INCY, Y
  186. decl %eax
  187. jg .L29
  188. ALIGN_3
  189. .L28:
  190. movl M, %eax
  191. andl $3, %eax
  192. jle .L40
  193. ALIGN_3
  194. .L35:
  195. FLD (X)
  196. fmul %st(1),%st
  197. FLD (Y)
  198. faddp %st, %st(1)
  199. FST (Y)
  200. addl INCX, X
  201. addl INCY, Y
  202. decl %eax
  203. jg .L35
  204. ALIGN_3
  205. .L40:
  206. ffreep %st(0)
  207. xorl %eax,%eax
  208. popl %ebx
  209. popl %esi
  210. popl %edi
  211. ret
  212. EPILOGUE