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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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. #if defined(DOUBLE) && !defined(__64BIT__)
  41. #define N %i0
  42. #define X %i5
  43. #define INCX %i1
  44. #define Y %i2
  45. #define INCY %i3
  46. #define I %i4
  47. #else
  48. #define N %i0
  49. #define X %i4
  50. #define INCX %i5
  51. #define Y %i1
  52. #define INCY %i2
  53. #define I %i3
  54. #endif
  55. #define XX %l0
  56. #define YY %l1
  57. #ifdef DOUBLE
  58. #define a1 %f0
  59. #define a2 %f2
  60. #define a3 %f4
  61. #define a4 %f6
  62. #define a5 %f8
  63. #define a6 %f10
  64. #define a7 %f12
  65. #define a8 %f14
  66. #define b1 %f16
  67. #define b2 %f18
  68. #define b3 %f20
  69. #define b4 %f22
  70. #define b5 %f24
  71. #define b6 %f26
  72. #define b7 %f28
  73. #define b8 %f30
  74. #else
  75. #define a1 %f0
  76. #define a2 %f1
  77. #define a3 %f2
  78. #define a4 %f3
  79. #define a5 %f4
  80. #define a6 %f5
  81. #define a7 %f6
  82. #define a8 %f7
  83. #define b1 %f8
  84. #define b2 %f9
  85. #define b3 %f10
  86. #define b4 %f11
  87. #define b5 %f12
  88. #define b6 %f13
  89. #define b7 %f14
  90. #define b8 %f15
  91. #endif
  92. #ifdef DOUBLE
  93. #define PREFETCHSIZE 128
  94. #else
  95. #define PREFETCHSIZE 256
  96. #endif
  97. PROLOGUE
  98. SAVESP
  99. #ifndef __64BIT__
  100. #ifdef DOUBLE
  101. ld [%sp + STACK_START + 28], INCX
  102. ld [%sp + STACK_START + 32], Y
  103. ld [%sp + STACK_START + 36], INCY
  104. #else
  105. ld [%sp+ STACK_START + 28], Y
  106. ld [%sp+ STACK_START + 32], INCY
  107. #endif
  108. #else
  109. ldx [%sp+ STACK_START + 56], Y
  110. ldx [%sp+ STACK_START + 64], INCY
  111. #endif
  112. sll INCX, BASE_SHIFT, INCX
  113. sll INCY, BASE_SHIFT, INCY
  114. cmp INCX, SIZE
  115. bne .LL50
  116. nop
  117. cmp INCY, SIZE
  118. bne .LL50
  119. nop
  120. sra N, 3, I
  121. cmp I, 0
  122. ble,pn %icc, .LL15
  123. nop
  124. LDF [X + 0 * SIZE], a1
  125. LDF [Y + 0 * SIZE], b1
  126. LDF [X + 1 * SIZE], a2
  127. LDF [Y + 1 * SIZE], b2
  128. LDF [X + 2 * SIZE], a3
  129. LDF [Y + 2 * SIZE], b3
  130. LDF [X + 3 * SIZE], a4
  131. LDF [Y + 3 * SIZE], b4
  132. LDF [X + 4 * SIZE], a5
  133. LDF [Y + 4 * SIZE], b5
  134. LDF [X + 5 * SIZE], a6
  135. LDF [Y + 5 * SIZE], b6
  136. LDF [X + 6 * SIZE], a7
  137. LDF [Y + 6 * SIZE], b7
  138. LDF [X + 7 * SIZE], a8
  139. LDF [Y + 7 * SIZE], b8
  140. deccc I
  141. ble,pn %icc, .LL12
  142. nop
  143. .LL11:
  144. prefetch [X + PREFETCHSIZE * SIZE], 0
  145. deccc I
  146. STF a1, [Y + 0 * SIZE]
  147. LDF [X + 8 * SIZE], a1
  148. STF b1, [X + 0 * SIZE]
  149. LDF [Y + 8 * SIZE], b1
  150. STF a2, [Y + 1 * SIZE]
  151. LDF [X + 9 * SIZE], a2
  152. STF b2, [X + 1 * SIZE]
  153. LDF [Y + 9 * SIZE], b2
  154. STF a3, [Y + 2 * SIZE]
  155. LDF [X + 10 * SIZE], a3
  156. STF b3, [X + 2 * SIZE]
  157. LDF [Y + 10 * SIZE], b3
  158. STF a4, [Y + 3 * SIZE]
  159. LDF [X + 11 * SIZE], a4
  160. STF b4, [X + 3 * SIZE]
  161. LDF [Y + 11 * SIZE], b4
  162. prefetch [Y + PREFETCHSIZE * SIZE], 0
  163. add X, 8 * SIZE, X
  164. STF a5, [Y + 4 * SIZE]
  165. LDF [X + 4 * SIZE], a5
  166. STF b5, [X - 4 * SIZE]
  167. LDF [Y + 12 * SIZE], b5
  168. STF a6, [Y + 5 * SIZE]
  169. LDF [X + 5 * SIZE], a6
  170. STF b6, [X - 3 * SIZE]
  171. LDF [Y + 13 * SIZE], b6
  172. STF a7, [Y + 6 * SIZE]
  173. LDF [X + 6 * SIZE], a7
  174. STF b7, [X - 2 * SIZE]
  175. LDF [Y + 14 * SIZE], b7
  176. STF a8, [Y + 7 * SIZE]
  177. LDF [X + 7 * SIZE], a8
  178. STF b8, [X - 1 * SIZE]
  179. LDF [Y + 15 * SIZE], b8
  180. bg,pt %icc, .LL11
  181. add Y, 8 * SIZE, Y
  182. .LL12:
  183. STF a1, [Y + 0 * SIZE]
  184. STF b1, [X + 0 * SIZE]
  185. STF a2, [Y + 1 * SIZE]
  186. STF b2, [X + 1 * SIZE]
  187. STF a3, [Y + 2 * SIZE]
  188. STF b3, [X + 2 * SIZE]
  189. STF a4, [Y + 3 * SIZE]
  190. STF b4, [X + 3 * SIZE]
  191. STF a5, [Y + 4 * SIZE]
  192. STF b5, [X + 4 * SIZE]
  193. STF a6, [Y + 5 * SIZE]
  194. STF b6, [X + 5 * SIZE]
  195. STF a7, [Y + 6 * SIZE]
  196. STF b7, [X + 6 * SIZE]
  197. STF a8, [Y + 7 * SIZE]
  198. STF b8, [X + 7 * SIZE]
  199. add X, 8 * SIZE, X
  200. add Y, 8 * SIZE, Y
  201. .LL15:
  202. and N, 7, I
  203. cmp I, 0
  204. ble,a,pn %icc, .LL19
  205. nop
  206. .LL16:
  207. LDF [X + 0 * SIZE], a1
  208. add I, -1, I
  209. LDF [Y + 0 * SIZE], b1
  210. cmp I, 0
  211. STF a1, [Y + 0 * SIZE]
  212. add Y, 1 * SIZE, Y
  213. STF b1, [X + 0 * SIZE]
  214. bg,pt %icc, .LL16
  215. add X, 1 * SIZE, X
  216. .LL19:
  217. return %i7 + 8
  218. clr %g0
  219. .LL50:
  220. sra N, 3, I
  221. mov X, XX
  222. cmp I, 0
  223. ble,pn %icc, .LL55
  224. mov Y, YY
  225. .LL51:
  226. LDF [X + 0 * SIZE], a1
  227. add X, INCX, X
  228. LDF [Y + 0 * SIZE], b1
  229. add Y, INCY, Y
  230. LDF [X + 0 * SIZE], a2
  231. add X, INCX, X
  232. LDF [Y + 0 * SIZE], b2
  233. add Y, INCY, Y
  234. LDF [X + 0 * SIZE], a3
  235. add X, INCX, X
  236. LDF [Y + 0 * SIZE], b3
  237. add Y, INCY, Y
  238. LDF [X + 0 * SIZE], a4
  239. add X, INCX, X
  240. LDF [Y + 0 * SIZE], b4
  241. add Y, INCY, Y
  242. LDF [X + 0 * SIZE], a5
  243. add X, INCX, X
  244. LDF [Y + 0 * SIZE], b5
  245. add Y, INCY, Y
  246. LDF [X + 0 * SIZE], a6
  247. add X, INCX, X
  248. LDF [Y + 0 * SIZE], b6
  249. add Y, INCY, Y
  250. LDF [X + 0 * SIZE], a7
  251. add X, INCX, X
  252. LDF [Y + 0 * SIZE], b7
  253. add Y, INCY, Y
  254. LDF [X + 0 * SIZE], a8
  255. add X, INCX, X
  256. LDF [Y + 0 * SIZE], b8
  257. add Y, INCY, Y
  258. STF a1, [YY + 0 * SIZE]
  259. add I, -1, I
  260. add YY, INCY, YY
  261. STF b1, [XX + 0 * SIZE]
  262. cmp I, 0
  263. add XX, INCX, XX
  264. STF a2, [YY + 0 * SIZE]
  265. add YY, INCY, YY
  266. STF b2, [XX + 0 * SIZE]
  267. add XX, INCX, XX
  268. STF a3, [YY + 0 * SIZE]
  269. add YY, INCY, YY
  270. STF b3, [XX + 0 * SIZE]
  271. add XX, INCX, XX
  272. STF a4, [YY + 0 * SIZE]
  273. add YY, INCY, YY
  274. STF b4, [XX + 0 * SIZE]
  275. add XX, INCX, XX
  276. STF a5, [YY + 0 * SIZE]
  277. add YY, INCY, YY
  278. STF b5, [XX + 0 * SIZE]
  279. add XX, INCX, XX
  280. STF a6, [YY + 0 * SIZE]
  281. add YY, INCY, YY
  282. STF b6, [XX + 0 * SIZE]
  283. add XX, INCX, XX
  284. STF a7, [YY + 0 * SIZE]
  285. add YY, INCY, YY
  286. STF b7, [XX + 0 * SIZE]
  287. add XX, INCX, XX
  288. STF a8, [YY + 0 * SIZE]
  289. add YY, INCY, YY
  290. STF b8, [XX + 0 * SIZE]
  291. bg,pt %icc, .LL51
  292. add XX, INCX, XX
  293. .LL55:
  294. and N, 7, I
  295. cmp I, 0
  296. ble,a,pn %icc, .LL59
  297. nop
  298. .LL56:
  299. LDF [X + 0 * SIZE], a1
  300. LDF [Y + 0 * SIZE], b1
  301. add I, -1, I
  302. cmp I, 0
  303. STF b1, [X + 0 * SIZE]
  304. add X, INCX, X
  305. STF a1, [Y + 0 * SIZE]
  306. bg,pt %icc, .LL56
  307. add Y, INCY, Y
  308. .LL59:
  309. return %i7 + 8
  310. clr %o0
  311. EPILOGUE