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_ncopy.S 7.2 kB

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