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_amd.S 5.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. PROLOGUE
  48. pushl %edi
  49. pushl %esi
  50. pushl %ebx
  51. PROFCODE
  52. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  53. EMMS
  54. #endif
  55. #define N %ebx
  56. #define X %esi
  57. #define INCX %ecx
  58. #define Y %edi
  59. #define INCY %edx
  60. movl STACK_N, N
  61. movl STACK_X, X
  62. movl STACK_INCX, INCX
  63. movl STACK_Y, Y
  64. movl STACK_INCY, INCY
  65. #ifdef F_INTERFACE
  66. movl (N),N
  67. movl (INCX),INCX
  68. movl (INCY),INCY
  69. #endif
  70. leal (, INCX, SIZE), INCX
  71. leal (, INCY, SIZE), INCY
  72. fldz
  73. fldz
  74. fldz
  75. fldz
  76. cmpl $SIZE, INCX
  77. jne .L14
  78. cmpl $SIZE, INCY
  79. jne .L14
  80. movl N, %eax
  81. sarl $3, %eax
  82. jle .L15
  83. FLD 0 * SIZE(X)
  84. ALIGN_4
  85. .L16:
  86. FLD 1 * SIZE(X)
  87. FMUL 1 * SIZE(Y)
  88. faddp %st,%st(2)
  89. FMUL 0 * SIZE(Y)
  90. faddp %st,%st(2)
  91. FLD 2 * SIZE(X)
  92. FLD 3 * SIZE(X)
  93. FMUL 3 * SIZE(Y)
  94. faddp %st,%st(4)
  95. FMUL 2 * SIZE(Y)
  96. faddp %st,%st(4)
  97. FLD 4 * SIZE(X)
  98. FLD 5 * SIZE(X)
  99. FMUL 5 * SIZE(Y)
  100. faddp %st,%st(2)
  101. FMUL 4 * SIZE(Y)
  102. faddp %st,%st(2)
  103. FLD 6 * SIZE(X)
  104. FLD 7 * SIZE(X)
  105. FMUL 7 * SIZE(Y)
  106. faddp %st,%st(4)
  107. FMUL 6 * SIZE(Y)
  108. faddp %st,%st(4)
  109. FLD 8 * SIZE(X)
  110. prefetch 16 * SIZE(X)
  111. addl $8 * SIZE, X
  112. addl $8 * SIZE, Y
  113. decl %eax
  114. jg .L16
  115. ffreep %st(0)
  116. ALIGN_3
  117. .L15:
  118. movl N, %eax
  119. andl $7, %eax
  120. jle .L27
  121. ALIGN_3
  122. .L22:
  123. FLD (X)
  124. addl $SIZE, X
  125. FMUL (Y)
  126. addl $SIZE, Y
  127. faddp %st,%st(1)
  128. decl %eax
  129. jg .L22
  130. jmp .L27
  131. ALIGN_3
  132. .L14:
  133. #ifdef F_INTERFACE
  134. testl INCX, INCX
  135. jge .L28
  136. movl N, %eax
  137. decl %eax
  138. imull INCX, %eax
  139. subl %eax, X
  140. ALIGN_3
  141. .L28:
  142. testl INCY, INCY
  143. jge .L29
  144. movl N, %eax
  145. decl %eax
  146. imull INCY, %eax
  147. subl %eax, Y
  148. ALIGN_3
  149. .L29:
  150. #endif
  151. movl N, %eax
  152. sarl $2, %eax
  153. jle .L30
  154. ALIGN_3
  155. .L31:
  156. FLD (X)
  157. addl INCX, X
  158. FMUL (Y)
  159. addl INCY, Y
  160. faddp %st,%st(1)
  161. FLD (X)
  162. addl INCX, X
  163. FMUL (Y)
  164. addl INCY, Y
  165. faddp %st,%st(2)
  166. FLD (X)
  167. addl INCX, X
  168. FMUL (Y)
  169. addl INCY, Y
  170. faddp %st,%st(3)
  171. FLD (X)
  172. addl INCX, X
  173. FMUL (Y)
  174. addl INCY, Y
  175. faddp %st,%st(4)
  176. decl %eax
  177. jg .L31
  178. ALIGN_3
  179. .L30:
  180. movl N, %eax
  181. andl $3, %eax
  182. jle .L27
  183. ALIGN_3
  184. .L37:
  185. FLD (X)
  186. addl INCX, X
  187. FMUL (Y)
  188. addl INCY, Y
  189. faddp %st, %st(1)
  190. decl %eax
  191. jg .L37
  192. ALIGN_3
  193. .L27:
  194. faddp %st,%st(2)
  195. faddp %st,%st(2)
  196. faddp %st,%st(1)
  197. popl %ebx
  198. popl %esi
  199. popl %edi
  200. ret
  201. EPILOGUE