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.

xaxpy.S 7.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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_R 16 + STACK + ARGS(%esp)
  44. #define STACK_ALPHA_I 32 + STACK + ARGS(%esp)
  45. #define STACK_X 48 + STACK + ARGS(%esp)
  46. #define STACK_INCX 52 + STACK + ARGS(%esp)
  47. #define STACK_Y 56 + STACK + ARGS(%esp)
  48. #define STACK_INCY 60 + STACK + ARGS(%esp)
  49. #define M %ebx
  50. #define X %esi
  51. #define INCX %ecx
  52. #define Y %edi
  53. #define INCY %edx
  54. #ifndef CONJ
  55. #define ADD1 fsubrp
  56. #define ADD2 faddp
  57. #else
  58. #define ADD1 faddp
  59. #define ADD2 fsubrp
  60. #endif
  61. PROLOGUE
  62. pushl %edi
  63. pushl %esi
  64. pushl %ebx
  65. PROFCODE
  66. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  67. EMMS
  68. #endif
  69. FLD STACK_ALPHA_I
  70. FLD STACK_ALPHA_R
  71. movl STACK_M, M
  72. movl STACK_X, X
  73. movl STACK_INCX, INCX
  74. movl STACK_Y, Y
  75. movl STACK_INCY, INCY
  76. sall $ZBASE_SHIFT, INCX
  77. sall $ZBASE_SHIFT, INCY
  78. testl M, M
  79. jle .L40
  80. cmpl $2 * SIZE, INCX
  81. jne .L14
  82. cmpl $2 * SIZE, INCY
  83. jne .L14
  84. movl M, %eax
  85. sarl $2, %eax
  86. jle .L15
  87. ALIGN_3
  88. .L16:
  89. FLD 0 * SIZE(X)
  90. fmul %st(1), %st
  91. FLD 1 * SIZE(X)
  92. fmul %st(3), %st
  93. ADD1 %st, %st(1)
  94. FLD 0 * SIZE(Y)
  95. faddp %st, %st(1)
  96. FST 0 * SIZE(Y)
  97. FLD 0 * SIZE(X)
  98. fmul %st(2), %st
  99. FLD 1 * SIZE(X)
  100. fmul %st(2), %st
  101. ADD2 %st, %st(1)
  102. FLD 1 * SIZE(Y)
  103. faddp %st, %st(1)
  104. FST 1 * SIZE(Y)
  105. FLD 2 * SIZE(X)
  106. fmul %st(1), %st
  107. FLD 3 * SIZE(X)
  108. fmul %st(3), %st
  109. ADD1 %st, %st(1)
  110. FLD 2 * SIZE(Y)
  111. faddp %st, %st(1)
  112. FST 2 * SIZE(Y)
  113. FLD 2 * SIZE(X)
  114. fmul %st(2), %st
  115. FLD 3 * SIZE(X)
  116. fmul %st(2), %st
  117. ADD2 %st, %st(1)
  118. FLD 3 * SIZE(Y)
  119. faddp %st, %st(1)
  120. FST 3 * SIZE(Y)
  121. FLD 4 * SIZE(X)
  122. fmul %st(1), %st
  123. FLD 5 * SIZE(X)
  124. fmul %st(3), %st
  125. ADD1 %st, %st(1)
  126. FLD 4 * SIZE(Y)
  127. faddp %st, %st(1)
  128. FST 4 * SIZE(Y)
  129. FLD 4 * SIZE(X)
  130. fmul %st(2), %st
  131. FLD 5 * SIZE(X)
  132. fmul %st(2), %st
  133. ADD2 %st, %st(1)
  134. FLD 5 * SIZE(Y)
  135. faddp %st, %st(1)
  136. FST 5 * SIZE(Y)
  137. FLD 6 * SIZE(X)
  138. fmul %st(1), %st
  139. FLD 7 * SIZE(X)
  140. fmul %st(3), %st
  141. ADD1 %st, %st(1)
  142. FLD 6 * SIZE(Y)
  143. faddp %st, %st(1)
  144. FST 6 * SIZE(Y)
  145. FLD 6 * SIZE(X)
  146. fmul %st(2), %st
  147. FLD 7 * SIZE(X)
  148. fmul %st(2), %st
  149. ADD2 %st, %st(1)
  150. FLD 7 * SIZE(Y)
  151. faddp %st, %st(1)
  152. FST 7 * SIZE(Y)
  153. #ifdef HAVE_3DNOW
  154. prefetch 20 * SIZE(X)
  155. prefetchw 20 * SIZE(Y)
  156. #endif
  157. addl $8 * SIZE, X
  158. addl $8 * SIZE, Y
  159. decl %eax
  160. jg .L16
  161. ALIGN_3
  162. .L15:
  163. movl M, %eax
  164. andl $3, %eax
  165. jle .L40
  166. ALIGN_3
  167. .L22:
  168. FLD 0 * SIZE(X)
  169. fmul %st(1), %st
  170. FLD 1 * SIZE(X)
  171. fmul %st(3), %st
  172. ADD1 %st, %st(1)
  173. FLD 0 * SIZE(Y)
  174. faddp %st, %st(1)
  175. FST 0 * SIZE(Y)
  176. FLD 0 * SIZE(X)
  177. fmul %st(2), %st
  178. FLD 1 * SIZE(X)
  179. fmul %st(2), %st
  180. ADD2 %st, %st(1)
  181. FLD 1 * SIZE(Y)
  182. faddp %st, %st(1)
  183. FST 1 * SIZE(Y)
  184. addl $2 * SIZE, X
  185. addl $2 * SIZE, Y
  186. decl %eax
  187. jg .L22
  188. jmp .L40
  189. ALIGN_3
  190. .L14:
  191. movl M, %eax
  192. sarl $2, %eax
  193. jle .L28
  194. ALIGN_3
  195. .L29:
  196. FLD 0 * SIZE(X)
  197. fmul %st(1), %st
  198. FLD 1 * SIZE(X)
  199. fmul %st(3), %st
  200. ADD1 %st, %st(1)
  201. FLD 0 * SIZE(Y)
  202. faddp %st, %st(1)
  203. FST 0 * SIZE(Y)
  204. FLD 0 * SIZE(X)
  205. fmul %st(2), %st
  206. FLD 1 * SIZE(X)
  207. fmul %st(2), %st
  208. ADD2 %st, %st(1)
  209. FLD 1 * SIZE(Y)
  210. faddp %st, %st(1)
  211. FST 1 * SIZE(Y)
  212. addl INCX, X
  213. addl INCY, Y
  214. FLD 0 * SIZE(X)
  215. fmul %st(1), %st
  216. FLD 1 * SIZE(X)
  217. fmul %st(3), %st
  218. ADD1 %st, %st(1)
  219. FLD 0 * SIZE(Y)
  220. faddp %st, %st(1)
  221. FST 0 * SIZE(Y)
  222. FLD 0 * SIZE(X)
  223. fmul %st(2), %st
  224. FLD 1 * SIZE(X)
  225. fmul %st(2), %st
  226. ADD2 %st, %st(1)
  227. FLD 1 * SIZE(Y)
  228. faddp %st, %st(1)
  229. FST 1 * SIZE(Y)
  230. addl INCX, X
  231. addl INCY, Y
  232. FLD 0 * SIZE(X)
  233. fmul %st(1), %st
  234. FLD 1 * SIZE(X)
  235. fmul %st(3), %st
  236. ADD1 %st, %st(1)
  237. FLD 0 * SIZE(Y)
  238. faddp %st, %st(1)
  239. FST 0 * SIZE(Y)
  240. FLD 0 * SIZE(X)
  241. fmul %st(2), %st
  242. FLD 1 * SIZE(X)
  243. fmul %st(2), %st
  244. ADD2 %st, %st(1)
  245. FLD 1 * SIZE(Y)
  246. faddp %st, %st(1)
  247. FST 1 * SIZE(Y)
  248. addl INCX, X
  249. addl INCY, Y
  250. FLD 0 * SIZE(X)
  251. fmul %st(1), %st
  252. FLD 1 * SIZE(X)
  253. fmul %st(3), %st
  254. ADD1 %st, %st(1)
  255. FLD 0 * SIZE(Y)
  256. faddp %st, %st(1)
  257. FST 0 * SIZE(Y)
  258. FLD 0 * SIZE(X)
  259. fmul %st(2), %st
  260. FLD 1 * SIZE(X)
  261. fmul %st(2), %st
  262. ADD2 %st, %st(1)
  263. FLD 1 * SIZE(Y)
  264. faddp %st, %st(1)
  265. FST 1 * SIZE(Y)
  266. addl INCX, X
  267. addl INCY, Y
  268. decl %eax
  269. jg .L29
  270. ALIGN_3
  271. .L28:
  272. movl M, %eax
  273. andl $3, %eax
  274. jle .L40
  275. ALIGN_3
  276. .L35:
  277. FLD 0 * SIZE(X)
  278. fmul %st(1), %st
  279. FLD 1 * SIZE(X)
  280. fmul %st(3), %st
  281. ADD1 %st, %st(1)
  282. FLD 0 * SIZE(Y)
  283. faddp %st, %st(1)
  284. FST 0 * SIZE(Y)
  285. FLD 0 * SIZE(X)
  286. fmul %st(2), %st
  287. FLD 1 * SIZE(X)
  288. fmul %st(2), %st
  289. ADD2 %st, %st(1)
  290. FLD 1 * SIZE(Y)
  291. faddp %st, %st(1)
  292. FST 1 * SIZE(Y)
  293. addl INCX, X
  294. addl INCY, Y
  295. decl %eax
  296. jg .L35
  297. ALIGN_3
  298. .L40:
  299. ffreep %st(0)
  300. ffreep %st(0)
  301. xorl %eax,%eax
  302. popl %ebx
  303. popl %esi
  304. popl %edi
  305. ret
  306. EPILOGUE