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_beta.S 4.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 $4
  41. #define N $5
  42. #define C $6
  43. #define LDC $7
  44. #define I $2
  45. #define J $3
  46. #define CO1 $8
  47. #define a1 $f0
  48. #define a2 $f1
  49. #define a3 $f2
  50. #define a4 $f3
  51. #define b1 $f4
  52. #define b2 $f5
  53. #define b3 $f6
  54. #define b4 $f7
  55. #define FZERO $f8
  56. #define ALPHA $f15
  57. PROLOGUE
  58. LDARG C, 0($sp)
  59. MTC $0, FZERO
  60. LDARG LDC, 8($sp)
  61. dsll LDC, LDC, BASE_SHIFT
  62. move J, N
  63. blez J, .L999
  64. nop
  65. .align 3
  66. .L10:
  67. move CO1, C
  68. dsra I, M, 3
  69. blez I, .L15
  70. daddu C, C, LDC
  71. LD a1, 0 * SIZE(CO1)
  72. LD a2, 1 * SIZE(CO1)
  73. LD a3, 2 * SIZE(CO1)
  74. LD a4, 3 * SIZE(CO1)
  75. MUL b1, ALPHA, a1
  76. LD a1, 4 * SIZE(CO1)
  77. MUL b2, ALPHA, a2
  78. daddiu I, I, -1
  79. blez I, .L13
  80. LD a2, 5 * SIZE(CO1)
  81. .align 3
  82. .L12:
  83. MUL b3, ALPHA, a3
  84. LD a3, 6 * SIZE(CO1)
  85. ST b1, 0 * SIZE(CO1)
  86. MUL b4, ALPHA, a4
  87. LD a4, 7 * SIZE(CO1)
  88. ST b2, 1 * SIZE(CO1)
  89. MUL b1, ALPHA, a1
  90. LD a1, 8 * SIZE(CO1)
  91. ST b3, 2 * SIZE(CO1)
  92. MUL b2, ALPHA, a2
  93. LD a2, 9 * SIZE(CO1)
  94. ST b4, 3 * SIZE(CO1)
  95. MUL b3, ALPHA, a3
  96. LD a3, 10 * SIZE(CO1)
  97. ST b1, 4 * SIZE(CO1)
  98. MUL b4, ALPHA, a4
  99. LD a4, 11 * SIZE(CO1)
  100. ST b2, 5 * SIZE(CO1)
  101. MUL b1, ALPHA, a1
  102. LD a1, 12 * SIZE(CO1)
  103. ST b3, 6 * SIZE(CO1)
  104. MUL b2, ALPHA, a2
  105. LD a2, 13 * SIZE(CO1)
  106. ST b4, 7 * SIZE(CO1)
  107. daddiu I, I, -1
  108. bgtz I, .L12
  109. daddiu CO1, CO1, 8 * SIZE
  110. .align 3
  111. .L13:
  112. MUL b3, ALPHA, a3
  113. LD a3, 6 * SIZE(CO1)
  114. ST b1, 0 * SIZE(CO1)
  115. MUL b4, ALPHA, a4
  116. LD a4, 7 * SIZE(CO1)
  117. ST b2, 1 * SIZE(CO1)
  118. MUL b1, ALPHA, a1
  119. ST b3, 2 * SIZE(CO1)
  120. MUL b2, ALPHA, a2
  121. ST b4, 3 * SIZE(CO1)
  122. MUL b3, ALPHA, a3
  123. ST b1, 4 * SIZE(CO1)
  124. MUL b4, ALPHA, a4
  125. ST b2, 5 * SIZE(CO1)
  126. ST b3, 6 * SIZE(CO1)
  127. ST b4, 7 * SIZE(CO1)
  128. daddiu CO1, CO1, 8 * SIZE
  129. .align 3
  130. .L15:
  131. andi I, M, 7
  132. daddiu J, J, -1
  133. blez I, .L18
  134. NOP
  135. .align 3
  136. .L16:
  137. LD a1, 0 * SIZE(CO1)
  138. daddiu I, I, -1
  139. MUL b1, ALPHA, a1
  140. daddiu CO1, CO1, 1 * SIZE
  141. bgtz I, .L16
  142. ST b1, -1 * SIZE(CO1)
  143. .align 3
  144. .L18:
  145. bgtz J, .L10
  146. NOP
  147. .align 3
  148. .L999:
  149. j $31
  150. NOP
  151. EPILOGUE