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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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 RESULT 4 + STACK + ARGS(%esp)
  43. #define STACK_N 8 + STACK + ARGS(%esp)
  44. #define STACK_X 12 + STACK + ARGS(%esp)
  45. #define STACK_INCX 16 + STACK + ARGS(%esp)
  46. #define STACK_Y 20 + STACK + ARGS(%esp)
  47. #define STACK_INCY 24 + STACK + ARGS(%esp)
  48. #include "l1param.h"
  49. PROLOGUE
  50. pushl %edi
  51. pushl %esi
  52. pushl %ebx
  53. PROFCODE
  54. #ifdef WINDOWS_ABI
  55. emms
  56. #endif
  57. #define N %ebx
  58. #define X %esi
  59. #define INCX %ecx
  60. #define Y %edi
  61. #define INCY %edx
  62. movl STACK_N, N
  63. movl STACK_X, X
  64. movl STACK_INCX, INCX
  65. movl STACK_Y, Y
  66. movl STACK_INCY, INCY
  67. testl N, N
  68. jle .L88
  69. sall $ZBASE_SHIFT, INCX
  70. sall $ZBASE_SHIFT, INCY
  71. fldz
  72. fldz
  73. fldz
  74. fldz
  75. cmpl $2 * SIZE, INCX
  76. jne .L14
  77. cmpl $2 * SIZE, INCY
  78. jne .L14
  79. movl N, %eax
  80. sarl $1, %eax
  81. jle .L15
  82. ALIGN_3
  83. .L16:
  84. #ifdef PREFETCH
  85. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  86. #endif
  87. FLD 0 * SIZE(X)
  88. FLD 0 * SIZE(Y)
  89. fmul %st(1)
  90. faddp %st, %st(2)
  91. FLD 1 * SIZE(Y)
  92. fmulp %st, %st(1)
  93. faddp %st, %st(2)
  94. FLD 1 * SIZE(X)
  95. FLD 0 * SIZE(Y)
  96. fmul %st(1)
  97. faddp %st, %st(4)
  98. FLD 1 * SIZE(Y)
  99. fmulp %st, %st(1)
  100. faddp %st, %st(4)
  101. FLD 2 * SIZE(X)
  102. #ifdef PREFETCH
  103. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(Y)
  104. #endif
  105. FLD 2 * SIZE(Y)
  106. fmul %st(1)
  107. faddp %st, %st(2)
  108. FLD 3 * SIZE(Y)
  109. fmulp %st, %st(1)
  110. faddp %st, %st(2)
  111. FLD 3 * SIZE(X)
  112. FLD 2 * SIZE(Y)
  113. fmul %st(1)
  114. faddp %st, %st(4)
  115. FLD 3 * SIZE(Y)
  116. fmulp %st, %st(1)
  117. faddp %st, %st(4)
  118. addl $4 * SIZE, X
  119. addl $4 * SIZE, Y
  120. decl %eax
  121. jg .L16
  122. ALIGN_3
  123. .L15:
  124. movl N, %eax
  125. andl $1, %eax
  126. jle .L27
  127. ALIGN_3
  128. .L22:
  129. FLD 0 * SIZE(X)
  130. FLD 0 * SIZE(Y)
  131. fmul %st(1)
  132. faddp %st, %st(2)
  133. FLD 1 * SIZE(Y)
  134. fmulp %st, %st(1)
  135. faddp %st, %st(2)
  136. FLD 1 * SIZE(X)
  137. FLD 0 * SIZE(Y)
  138. fmul %st(1)
  139. faddp %st, %st(4)
  140. FLD 1 * SIZE(Y)
  141. fmulp %st, %st(1)
  142. faddp %st, %st(4)
  143. jmp .L27
  144. ALIGN_3
  145. .L14:
  146. movl N, %eax
  147. sarl $1, %eax
  148. jle .L30
  149. ALIGN_3
  150. .L31:
  151. FLD 0 * SIZE(X)
  152. FLD 0 * SIZE(Y)
  153. fmul %st(1)
  154. faddp %st, %st(2)
  155. FLD 1 * SIZE(Y)
  156. fmulp %st, %st(1)
  157. faddp %st, %st(2)
  158. FLD 1 * SIZE(X)
  159. FLD 0 * SIZE(Y)
  160. fmul %st(1)
  161. faddp %st, %st(4)
  162. FLD 1 * SIZE(Y)
  163. fmulp %st, %st(1)
  164. faddp %st, %st(4)
  165. addl INCX, X
  166. FLD 0 * SIZE(X)
  167. addl INCY, Y
  168. FLD 0 * SIZE(Y)
  169. fmul %st(1)
  170. faddp %st, %st(2)
  171. FLD 1 * SIZE(Y)
  172. fmulp %st, %st(1)
  173. faddp %st, %st(2)
  174. FLD 1 * SIZE(X)
  175. FLD 0 * SIZE(Y)
  176. fmul %st(1)
  177. faddp %st, %st(4)
  178. FLD 1 * SIZE(Y)
  179. fmulp %st, %st(1)
  180. faddp %st, %st(4)
  181. addl INCX, X
  182. addl INCY, Y
  183. decl %eax
  184. jg .L31
  185. ALIGN_3
  186. .L30:
  187. movl N, %eax
  188. andl $1, %eax
  189. jle .L27
  190. ALIGN_3
  191. .L37:
  192. FLD 0 * SIZE(X)
  193. FLD 0 * SIZE(Y)
  194. fmul %st(1)
  195. faddp %st, %st(2)
  196. FLD 1 * SIZE(Y)
  197. fmulp %st, %st(1)
  198. faddp %st, %st(2)
  199. FLD 1 * SIZE(X)
  200. FLD 0 * SIZE(Y)
  201. fmul %st(1)
  202. faddp %st, %st(4)
  203. FLD 1 * SIZE(Y)
  204. fmulp %st, %st(1)
  205. faddp %st, %st(4)
  206. ALIGN_3
  207. .L27:
  208. movl RESULT, %eax
  209. #ifndef CONJ
  210. fsubp %st, %st(3)
  211. faddp %st, %st(1)
  212. #else
  213. faddp %st, %st(3)
  214. fsubp %st, %st(1)
  215. #endif
  216. FST 1 * SIZE(%eax)
  217. FST 0 * SIZE(%eax)
  218. popl %ebx
  219. popl %esi
  220. popl %edi
  221. ret
  222. ALIGN_3
  223. .L88:
  224. movl RESULT, %eax
  225. fldz
  226. fldz
  227. FST 1 * SIZE(%eax)
  228. FST 0 * SIZE(%eax)
  229. popl %ebx
  230. popl %esi
  231. popl %edi
  232. ret
  233. EPILOGUE