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

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