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 6.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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 r3
  41. #define N r4
  42. #define C r10
  43. #define LDC r11
  44. #define J r5
  45. #define PRE r6
  46. #define CO1 r7
  47. #define ALPHA f31
  48. #define STACKSIZE 32
  49. PROLOGUE
  50. PROFCODE
  51. addi SP, SP, -STACKSIZE
  52. li r0, 0
  53. stfd f14, 0(SP)
  54. stfd f15, 8(SP)
  55. stfd f31, 16(SP)
  56. stw r0, 24(SP)
  57. #ifdef linux
  58. #ifndef __64BIT__
  59. lwz LDC, 8 + STACKSIZE(SP)
  60. #else
  61. ld C, 112 + STACKSIZE(SP)
  62. ld LDC, 120 + STACKSIZE(SP)
  63. #endif
  64. #endif
  65. #if defined(_AIX) || defined(__APPLE__)
  66. #ifdef __64BIT__
  67. ld C, 112 + STACKSIZE(SP)
  68. ld LDC, 120 + STACKSIZE(SP)
  69. #else
  70. #ifdef DOUBLE
  71. lwz C, 60 + STACKSIZE(SP)
  72. lwz LDC, 64 + STACKSIZE(SP)
  73. #else
  74. lwz C, 56 + STACKSIZE(SP)
  75. lwz LDC, 60 + STACKSIZE(SP)
  76. #endif
  77. #endif
  78. #endif
  79. slwi LDC, LDC, BASE_SHIFT
  80. fmr ALPHA, f1
  81. lfs f0, 24(SP)
  82. cmpwi cr0, M, 0
  83. ble- LL(999)
  84. cmpwi cr0, N, 0
  85. ble- LL(999)
  86. mr J, N
  87. fcmpu cr7, f1, f0
  88. bne cr7, LL(20)
  89. .align 4
  90. LL(10):
  91. mr CO1, C
  92. add C, C, LDC
  93. addi PRE, 0, 32 * SIZE
  94. srawi. r0, M, 4
  95. mtspr CTR, r0
  96. ble LL(15)
  97. .align 4
  98. LL(12):
  99. STFD f0, 0 * SIZE(CO1)
  100. STFD f0, 1 * SIZE(CO1)
  101. STFD f0, 2 * SIZE(CO1)
  102. STFD f0, 3 * SIZE(CO1)
  103. STFD f0, 4 * SIZE(CO1)
  104. STFD f0, 5 * SIZE(CO1)
  105. STFD f0, 6 * SIZE(CO1)
  106. STFD f0, 7 * SIZE(CO1)
  107. STFD f0, 8 * SIZE(CO1)
  108. STFD f0, 9 * SIZE(CO1)
  109. STFD f0, 10 * SIZE(CO1)
  110. STFD f0, 11 * SIZE(CO1)
  111. STFD f0, 12 * SIZE(CO1)
  112. STFD f0, 13 * SIZE(CO1)
  113. STFD f0, 14 * SIZE(CO1)
  114. STFD f0, 15 * SIZE(CO1)
  115. dcbst PRE, CO1
  116. addi CO1, CO1, 16 * SIZE
  117. bdnz LL(12)
  118. .align 4
  119. LL(15):
  120. andi. r0, M, 15
  121. mtspr CTR, r0
  122. beq LL(19)
  123. .align 4
  124. LL(16):
  125. STFD f0, 0 * SIZE(CO1)
  126. addi CO1, CO1, 1 * SIZE
  127. bdnz LL(16)
  128. .align 4
  129. LL(19):
  130. addic. J, J, -1
  131. bgt LL(10)
  132. b LL(999)
  133. .align 4
  134. LL(20):
  135. mr CO1, C
  136. add C, C, LDC
  137. addi PRE, 0, 16 * SIZE
  138. srawi. r0, M, 4
  139. mtspr CTR, r0
  140. ble LL(25)
  141. .align 4
  142. LL(22):
  143. LFD f0, 0 * SIZE(CO1)
  144. LFD f1, 1 * SIZE(CO1)
  145. LFD f2, 2 * SIZE(CO1)
  146. LFD f3, 3 * SIZE(CO1)
  147. LFD f4, 4 * SIZE(CO1)
  148. LFD f5, 5 * SIZE(CO1)
  149. LFD f6, 6 * SIZE(CO1)
  150. LFD f7, 7 * SIZE(CO1)
  151. LFD f8, 8 * SIZE(CO1)
  152. LFD f9, 9 * SIZE(CO1)
  153. LFD f10, 10 * SIZE(CO1)
  154. LFD f11, 11 * SIZE(CO1)
  155. LFD f12, 12 * SIZE(CO1)
  156. LFD f13, 13 * SIZE(CO1)
  157. LFD f14, 14 * SIZE(CO1)
  158. LFD f15, 15 * SIZE(CO1)
  159. FMUL f0, ALPHA, f0
  160. FMUL f1, ALPHA, f1
  161. FMUL f2, ALPHA, f2
  162. FMUL f3, ALPHA, f3
  163. FMUL f4, ALPHA, f4
  164. FMUL f5, ALPHA, f5
  165. FMUL f6, ALPHA, f6
  166. FMUL f7, ALPHA, f7
  167. FMUL f8, ALPHA, f8
  168. FMUL f9, ALPHA, f9
  169. FMUL f10, ALPHA, f10
  170. FMUL f11, ALPHA, f11
  171. FMUL f12, ALPHA, f12
  172. FMUL f13, ALPHA, f13
  173. FMUL f14, ALPHA, f14
  174. FMUL f15, ALPHA, f15
  175. STFD f0, 0 * SIZE(CO1)
  176. STFD f1, 1 * SIZE(CO1)
  177. STFD f2, 2 * SIZE(CO1)
  178. STFD f3, 3 * SIZE(CO1)
  179. STFD f4, 4 * SIZE(CO1)
  180. STFD f5, 5 * SIZE(CO1)
  181. STFD f6, 6 * SIZE(CO1)
  182. STFD f7, 7 * SIZE(CO1)
  183. STFD f8, 8 * SIZE(CO1)
  184. STFD f9, 9 * SIZE(CO1)
  185. STFD f10, 10 * SIZE(CO1)
  186. STFD f11, 11 * SIZE(CO1)
  187. STFD f12, 12 * SIZE(CO1)
  188. STFD f13, 13 * SIZE(CO1)
  189. STFD f14, 14 * SIZE(CO1)
  190. STFD f15, 15 * SIZE(CO1)
  191. addi CO1, CO1, 16 * SIZE
  192. dcbtst PRE, CO1
  193. bdnz LL(22)
  194. .align 4
  195. LL(25):
  196. andi. r0, M, 15
  197. mtspr CTR, r0
  198. ble LL(29)
  199. .align 4
  200. LL(26):
  201. LFD f0, 0 * SIZE(CO1)
  202. FMUL f0, f0, ALPHA
  203. STFD f0, 0 * SIZE(CO1)
  204. addi CO1, CO1, 1 * SIZE
  205. bdnz LL(26)
  206. .align 4
  207. LL(29):
  208. addic. J, J, -1
  209. bgt LL(20)
  210. .align 4
  211. LL(999):
  212. li r3, 0
  213. lfd f14, 0(SP)
  214. lfd f15, 8(SP)
  215. lfd f31, 16(SP)
  216. addi SP, SP, STACKSIZE
  217. blr
  218. EPILOGUE