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.

xdot.S 5.9 kB

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