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.

gemm_tcopy_2.S 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /*********************************************************************/
  2. /* Copyright 2005-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 PREFETCHSIZE 72
  41. #define WPREFETCHSIZE 16
  42. #define M %i0
  43. #define N %i1
  44. #define A %i2
  45. #define LDA %i3
  46. #define B %i4
  47. #define A1 %l0
  48. #define A2 %l1
  49. #define A3 %l2
  50. #define A4 %l3
  51. #define I %l4
  52. #define J %l5
  53. #define B1 %o0
  54. #define B2 %o1
  55. #define B3 %o3
  56. #define M2 %o4
  57. #ifdef DOUBLE
  58. #define c01 %f0
  59. #define c02 %f2
  60. #define c03 %f4
  61. #define c04 %f6
  62. #define c05 %f8
  63. #define c06 %f10
  64. #define c07 %f12
  65. #define c08 %f14
  66. #define c09 %f16
  67. #define c10 %f18
  68. #define c11 %f20
  69. #define c12 %f22
  70. #define c13 %f24
  71. #define c14 %f26
  72. #define c15 %f28
  73. #define c16 %f30
  74. #else
  75. #define c01 %f0
  76. #define c02 %f1
  77. #define c03 %f2
  78. #define c04 %f3
  79. #define c05 %f4
  80. #define c06 %f5
  81. #define c07 %f6
  82. #define c08 %f7
  83. #define c09 %f8
  84. #define c10 %f9
  85. #define c11 %f10
  86. #define c12 %f11
  87. #define c13 %f12
  88. #define c14 %f13
  89. #define c15 %f14
  90. #define c16 %f15
  91. #endif
  92. PROLOGUE
  93. SAVESP
  94. sll M, BASE_SHIFT + 1, M2
  95. and N, -2, B2
  96. sll M, BASE_SHIFT, B1
  97. smul B1, B2, B2
  98. add B, B2, B2
  99. sra M, 1, J
  100. cmp J, 0
  101. ble,pn %icc, .LL100
  102. sll LDA, BASE_SHIFT, LDA
  103. .LL11:
  104. add A, LDA, A2
  105. mov A, A1
  106. sra N, 3, I
  107. cmp I, 0
  108. mov B, B1
  109. add B, 4 * SIZE, B
  110. ble,pn %icc, .LL13
  111. add A2, LDA, A
  112. .align 4
  113. .LL12:
  114. prefetch [A1 + (PREFETCHSIZE + 0) * SIZE], 0
  115. LDF [A1 + 0 * SIZE], c01
  116. LDF [A1 + 1 * SIZE], c02
  117. LDF [A2 + 0 * SIZE], c09
  118. LDF [A2 + 1 * SIZE], c10
  119. LDF [A1 + 2 * SIZE], c03
  120. LDF [A1 + 3 * SIZE], c04
  121. LDF [A2 + 2 * SIZE], c11
  122. LDF [A2 + 3 * SIZE], c12
  123. prefetch [A2 + (PREFETCHSIZE + 0) * SIZE], 0
  124. LDF [A1 + 4 * SIZE], c05
  125. LDF [A1 + 5 * SIZE], c06
  126. LDF [A2 + 4 * SIZE], c13
  127. LDF [A2 + 5 * SIZE], c14
  128. LDF [A1 + 6 * SIZE], c07
  129. LDF [A1 + 7 * SIZE], c08
  130. LDF [A2 + 6 * SIZE], c15
  131. LDF [A2 + 7 * SIZE], c16
  132. add A1, 8 * SIZE, A1
  133. add A2, 8 * SIZE, A2
  134. add I, -1, I
  135. cmp I, 0
  136. prefetch [B1 + (WPREFETCHSIZE + 0) * SIZE], 0
  137. STF c01, [B1 + 0 * SIZE]
  138. STF c02, [B1 + 1 * SIZE]
  139. STF c09, [B1 + 2 * SIZE]
  140. STF c10, [B1 + 3 * SIZE]
  141. add B1, M2, B1
  142. prefetch [B1 + (WPREFETCHSIZE + 0) * SIZE], 0
  143. STF c03, [B1 + 0 * SIZE]
  144. STF c04, [B1 + 1 * SIZE]
  145. STF c11, [B1 + 2 * SIZE]
  146. STF c12, [B1 + 3 * SIZE]
  147. add B1, M2, B1
  148. prefetch [B1 + (WPREFETCHSIZE + 0) * SIZE], 0
  149. STF c05, [B1 + 0 * SIZE]
  150. STF c06, [B1 + 1 * SIZE]
  151. STF c13, [B1 + 2 * SIZE]
  152. STF c14, [B1 + 3 * SIZE]
  153. add B1, M2, B1
  154. prefetch [B1 + (WPREFETCHSIZE + 0) * SIZE], 0
  155. STF c07, [B1 + 0 * SIZE]
  156. STF c08, [B1 + 1 * SIZE]
  157. STF c15, [B1 + 2 * SIZE]
  158. STF c16, [B1 + 3 * SIZE]
  159. bg,pt %icc, .LL12
  160. add B1, M2, B1
  161. .LL13:
  162. and N, 4, I
  163. cmp I, 0
  164. ble,pn %icc, .LL14
  165. nop
  166. LDF [A1 + 0 * SIZE], c01
  167. LDF [A1 + 1 * SIZE], c02
  168. LDF [A2 + 0 * SIZE], c03
  169. LDF [A2 + 1 * SIZE], c04
  170. LDF [A1 + 2 * SIZE], c05
  171. LDF [A1 + 3 * SIZE], c06
  172. LDF [A2 + 2 * SIZE], c07
  173. LDF [A2 + 3 * SIZE], c08
  174. add A1, 4 * SIZE, A1
  175. add A2, 4 * SIZE, A2
  176. STF c01, [B1 + 0 * SIZE]
  177. STF c02, [B1 + 1 * SIZE]
  178. STF c03, [B1 + 2 * SIZE]
  179. STF c04, [B1 + 3 * SIZE]
  180. add B1, M2, B1
  181. STF c05, [B1 + 0 * SIZE]
  182. STF c06, [B1 + 1 * SIZE]
  183. STF c07, [B1 + 2 * SIZE]
  184. STF c08, [B1 + 3 * SIZE]
  185. add B1, M2, B1
  186. .align 4
  187. .LL14:
  188. and N, 2, I
  189. cmp I, 0
  190. ble,pn %icc, .LL15
  191. nop
  192. LDF [A1 + 0 * SIZE], c01
  193. LDF [A1 + 1 * SIZE], c02
  194. LDF [A2 + 0 * SIZE], c03
  195. LDF [A2 + 1 * SIZE], c04
  196. add A1, 2 * SIZE, A1
  197. add A2, 2 * SIZE, A2
  198. STF c01, [B1 + 0 * SIZE]
  199. STF c02, [B1 + 1 * SIZE]
  200. STF c03, [B1 + 2 * SIZE]
  201. STF c04, [B1 + 3 * SIZE]
  202. add B1, M2, B1
  203. .align 4
  204. .LL15:
  205. and N, 1, I
  206. cmp I, 0
  207. ble,pn %icc, .LL99
  208. nop
  209. LDF [A1 + 0 * SIZE], c01
  210. LDF [A2 + 0 * SIZE], c02
  211. STF c01, [B2 + 0 * SIZE]
  212. STF c02, [B2 + 1 * SIZE]
  213. add B2, 2 * SIZE, B2
  214. .LL99:
  215. add J, -1, J
  216. cmp J, 0
  217. bg,pt %icc, .LL11
  218. nop
  219. .LL100:
  220. and M, 1, J
  221. cmp J, 0
  222. ble,pn %icc, .LL999
  223. nop
  224. .LL211:
  225. sra N, 1, I
  226. cmp I, 0
  227. mov B, B1
  228. ble,pn %icc, .LL215
  229. mov A, A1
  230. .LL212:
  231. LDF [A1 + 0 * SIZE], c01
  232. LDF [A1 + 1 * SIZE], c02
  233. add A1, 2 * SIZE, A1
  234. add I, -1, I
  235. cmp I, 0
  236. STF c01, [B + 0 * SIZE]
  237. STF c02, [B + 1 * SIZE]
  238. bg,pt %icc, .LL212
  239. add B, M2, B
  240. .LL215:
  241. and N, 1, I
  242. cmp I, 0
  243. ble,pn %icc, .LL999
  244. nop
  245. LDF [A1 + 0 * SIZE], c01
  246. STF c01, [B2 + 0 * SIZE]
  247. .LL999:
  248. return %i7 + 8
  249. clr %o0
  250. EPILOGUE