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.

zgemm_tcopy.S 7.1 kB

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