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.

zswap.S 8.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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 %i1
  43. #define INCX %i2
  44. #define Y %i3
  45. #define INCY %i4
  46. #define I %i5
  47. #else
  48. #define N %i0
  49. #define X %i5
  50. #define INCX %i1
  51. #define Y %i2
  52. #define INCY %i3
  53. #define I %i4
  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 + 32], X
  102. ld [%sp + STACK_START + 36], INCX
  103. ld [%sp + STACK_START + 40], Y
  104. ld [%sp + STACK_START + 44], INCY
  105. #else
  106. ld [%sp + STACK_START + 28], INCX
  107. ld [%sp + STACK_START + 32], Y
  108. ld [%sp + STACK_START + 36], INCY
  109. #endif
  110. #else
  111. ldx [%sp + STACK_START + 56], INCX
  112. ldx [%sp + STACK_START + 64], Y
  113. ldx [%sp + STACK_START + 72], INCY
  114. #endif
  115. sll INCX, ZBASE_SHIFT, INCX
  116. sll INCY, ZBASE_SHIFT, INCY
  117. cmp INCX, 2 * SIZE
  118. bne .LL50
  119. nop
  120. cmp INCY, 2 * SIZE
  121. bne .LL50
  122. nop
  123. sra N, 2, I
  124. cmp I, 0
  125. ble,pn %icc, .LL15
  126. nop
  127. LDF [X + 0 * SIZE], a1
  128. LDF [Y + 0 * SIZE], b1
  129. LDF [X + 1 * SIZE], a2
  130. LDF [Y + 1 * SIZE], b2
  131. LDF [X + 2 * SIZE], a3
  132. LDF [Y + 2 * SIZE], b3
  133. LDF [X + 3 * SIZE], a4
  134. LDF [Y + 3 * SIZE], b4
  135. LDF [X + 4 * SIZE], a5
  136. LDF [Y + 4 * SIZE], b5
  137. LDF [X + 5 * SIZE], a6
  138. LDF [Y + 5 * SIZE], b6
  139. LDF [X + 6 * SIZE], a7
  140. LDF [Y + 6 * SIZE], b7
  141. LDF [X + 7 * SIZE], a8
  142. LDF [Y + 7 * SIZE], b8
  143. deccc I
  144. ble,pn %icc, .LL12
  145. nop
  146. .LL11:
  147. prefetch [X + PREFETCHSIZE * SIZE], 0
  148. deccc I
  149. STF a1, [Y + 0 * SIZE]
  150. LDF [X + 8 * SIZE], a1
  151. STF b1, [X + 0 * SIZE]
  152. LDF [Y + 8 * SIZE], b1
  153. STF a2, [Y + 1 * SIZE]
  154. LDF [X + 9 * SIZE], a2
  155. STF b2, [X + 1 * SIZE]
  156. LDF [Y + 9 * SIZE], b2
  157. STF a3, [Y + 2 * SIZE]
  158. LDF [X + 10 * SIZE], a3
  159. STF b3, [X + 2 * SIZE]
  160. LDF [Y + 10 * SIZE], b3
  161. STF a4, [Y + 3 * SIZE]
  162. LDF [X + 11 * SIZE], a4
  163. STF b4, [X + 3 * SIZE]
  164. LDF [Y + 11 * SIZE], b4
  165. prefetch [Y + PREFETCHSIZE * SIZE], 0
  166. add X, 8 * SIZE, X
  167. STF a5, [Y + 4 * SIZE]
  168. LDF [X + 4 * SIZE], a5
  169. STF b5, [X - 4 * SIZE]
  170. LDF [Y + 12 * SIZE], b5
  171. STF a6, [Y + 5 * SIZE]
  172. LDF [X + 5 * SIZE], a6
  173. STF b6, [X - 3 * SIZE]
  174. LDF [Y + 13 * SIZE], b6
  175. STF a7, [Y + 6 * SIZE]
  176. LDF [X + 6 * SIZE], a7
  177. STF b7, [X - 2 * SIZE]
  178. LDF [Y + 14 * SIZE], b7
  179. STF a8, [Y + 7 * SIZE]
  180. LDF [X + 7 * SIZE], a8
  181. STF b8, [X - 1 * SIZE]
  182. LDF [Y + 15 * SIZE], b8
  183. bg,pt %icc, .LL11
  184. add Y, 8 * SIZE, Y
  185. .LL12:
  186. STF a1, [Y + 0 * SIZE]
  187. STF b1, [X + 0 * SIZE]
  188. STF a2, [Y + 1 * SIZE]
  189. STF b2, [X + 1 * SIZE]
  190. STF a3, [Y + 2 * SIZE]
  191. STF b3, [X + 2 * SIZE]
  192. STF a4, [Y + 3 * SIZE]
  193. STF b4, [X + 3 * SIZE]
  194. STF a5, [Y + 4 * SIZE]
  195. STF b5, [X + 4 * SIZE]
  196. STF a6, [Y + 5 * SIZE]
  197. STF b6, [X + 5 * SIZE]
  198. STF a7, [Y + 6 * SIZE]
  199. STF b7, [X + 6 * SIZE]
  200. STF a8, [Y + 7 * SIZE]
  201. STF b8, [X + 7 * SIZE]
  202. add X, 8 * SIZE, X
  203. add Y, 8 * SIZE, Y
  204. .LL15:
  205. and N, 3, I
  206. cmp I, 0
  207. ble,a,pn %icc, .LL19
  208. nop
  209. .LL16:
  210. LDF [X + 0 * SIZE], a1
  211. add I, -1, I
  212. LDF [X + 1 * SIZE], a2
  213. LDF [Y + 0 * SIZE], b1
  214. LDF [Y + 1 * SIZE], b2
  215. cmp I, 0
  216. STF a1, [Y + 0 * SIZE]
  217. STF a2, [Y + 1 * SIZE]
  218. add Y, 2 * SIZE, Y
  219. STF b1, [X + 0 * SIZE]
  220. STF b2, [X + 1 * SIZE]
  221. bg,pt %icc, .LL16
  222. add X, 2 * SIZE, X
  223. .LL19:
  224. return %i7 + 8
  225. clr %g0
  226. .LL50:
  227. sra N, 2, I
  228. mov X, XX
  229. cmp I, 0
  230. ble,pn %icc, .LL55
  231. mov Y, YY
  232. .LL51:
  233. LDF [X + 0 * SIZE], a1
  234. LDF [Y + 0 * SIZE], b1
  235. LDF [X + 1 * SIZE], a2
  236. add X, INCX, X
  237. LDF [Y + 1 * SIZE], b2
  238. add Y, INCY, Y
  239. LDF [X + 0 * SIZE], a3
  240. LDF [Y + 0 * SIZE], b3
  241. LDF [X + 1 * SIZE], a4
  242. add X, INCX, X
  243. LDF [Y + 1 * SIZE], b4
  244. add Y, INCY, Y
  245. LDF [X + 0 * SIZE], a5
  246. LDF [Y + 0 * SIZE], b5
  247. LDF [X + 1 * SIZE], a6
  248. add X, INCX, X
  249. LDF [Y + 1 * SIZE], b6
  250. add Y, INCY, Y
  251. LDF [X + 0 * SIZE], a7
  252. LDF [Y + 0 * SIZE], b7
  253. LDF [X + 1 * SIZE], a8
  254. add X, INCX, X
  255. LDF [Y + 1 * SIZE], b8
  256. add Y, INCY, Y
  257. STF a1, [YY + 0 * SIZE]
  258. add I, -1, I
  259. STF b1, [XX + 0 * SIZE]
  260. cmp I, 0
  261. STF a2, [YY + 1 * SIZE]
  262. add YY, INCY, YY
  263. STF b2, [XX + 1 * SIZE]
  264. add XX, INCX, XX
  265. STF a3, [YY + 0 * SIZE]
  266. STF b3, [XX + 0 * SIZE]
  267. STF a4, [YY + 1 * SIZE]
  268. add YY, INCY, YY
  269. STF b4, [XX + 1 * SIZE]
  270. add XX, INCX, XX
  271. STF a5, [YY + 0 * SIZE]
  272. STF b5, [XX + 0 * SIZE]
  273. STF a6, [YY + 1 * SIZE]
  274. add YY, INCY, YY
  275. STF b6, [XX + 1 * SIZE]
  276. add XX, INCX, XX
  277. STF a7, [YY + 0 * SIZE]
  278. STF b7, [XX + 0 * SIZE]
  279. STF a8, [YY + 1 * SIZE]
  280. add YY, INCY, YY
  281. STF b8, [XX + 1 * SIZE]
  282. bg,pt %icc, .LL51
  283. add XX, INCX, XX
  284. .LL55:
  285. and N, 3, I
  286. cmp I, 0
  287. ble,a,pn %icc, .LL59
  288. nop
  289. .LL56:
  290. LDF [X + 0 * SIZE], a1
  291. add I, -1, I
  292. LDF [X + 1 * SIZE], a2
  293. LDF [Y + 0 * SIZE], b1
  294. cmp I, 0
  295. LDF [Y + 1 * SIZE], b2
  296. STF b1, [X + 0 * SIZE]
  297. STF b2, [X + 1 * SIZE]
  298. add X, INCX, X
  299. STF a1, [Y + 0 * SIZE]
  300. STF a2, [Y + 1 * SIZE]
  301. bg,pt %icc, .LL56
  302. add Y, INCY, Y
  303. .LL59:
  304. return %i7 + 8
  305. clr %o0
  306. EPILOGUE