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_2.S 5.8 kB

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