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

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