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.

cgemm_kernel_power10.S 6.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /***************************************************************************
  2. Copyright (c) 2013-2020, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  25. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *****************************************************************************/
  27. #define ASSEMBLER
  28. #include "common.h"
  29. #include "def_vsx.h"
  30. #define LOAD ld
  31. #define STACKSIZE (512 )
  32. #define FLINK_SAVE (STACKSIZE+16) /* 16($r12) */
  33. #define M r3
  34. #define N r4
  35. #define K r5
  36. #define A r8
  37. #define B r9
  38. #define C r10
  39. #define LDC r6
  40. #define OFFSET r7
  41. #define alpha_r vs51
  42. #define alpha_i vs55
  43. #define save_permute_1 vs59
  44. #define permute_mask vs63
  45. #define o0 0
  46. #define T1 r11
  47. #define T2 r12
  48. #define T3 r14
  49. #define T4 r15
  50. #define T5 r16
  51. #define T6 r17
  52. #define L r18
  53. #define T7 r19
  54. #define T8 r20
  55. #define TEMP_REG r21
  56. #define I r22
  57. #define J r23
  58. #define AO r24
  59. #define BO r25
  60. #define CO r26
  61. #define T9 r27
  62. #define T10 r28
  63. #define PRE r29
  64. #define T12 r30
  65. #define T13 r31
  66. #include "cgemm_macros_power10.S"
  67. .equ perm_const1, 0x0405060700010203
  68. .equ perm_const2, 0x0c0d0e0f08090a0b
  69. .equ save_permute_12, 0x0c0d0e0f1c1d1e1f
  70. .equ save_permute_11, 0x0405060714151617
  71. #ifndef NEEDPARAM
  72. PROLOGUE
  73. PROFCODE
  74. addi SP, SP, -STACKSIZE
  75. mflr r0
  76. stfd f14, 0(SP)
  77. stfd f15, 8(SP)
  78. stfd f16, 16(SP)
  79. stfd f17, 24(SP)
  80. stfd f18, 32(SP)
  81. stfd f19, 40(SP)
  82. stfd f20, 48(SP)
  83. stfd f21, 56(SP)
  84. stfd f22, 64(SP)
  85. stfd f23, 72(SP)
  86. stfd f24, 80(SP)
  87. stfd f25, 88(SP)
  88. stfd f26, 96(SP)
  89. stfd f27, 104(SP)
  90. stfd f28, 112(SP)
  91. stfd f29, 120(SP)
  92. stfd f30, 128(SP)
  93. stfd f31, 136(SP)
  94. std r31, 144(SP)
  95. std r30, 152(SP)
  96. std r29, 160(SP)
  97. std r28, 168(SP)
  98. std r27, 176(SP)
  99. std r26, 184(SP)
  100. std r25, 192(SP)
  101. std r24, 200(SP)
  102. std r23, 208(SP)
  103. std r22, 216(SP)
  104. std r21, 224(SP)
  105. std r20, 232(SP)
  106. std r19, 240(SP)
  107. std r18, 248(SP)
  108. std r17, 256(SP)
  109. std r16, 264(SP)
  110. std r15, 272(SP)
  111. std r14, 280(SP)
  112. stxv vs52, 288(SP)
  113. stxv vs53, 304(SP)
  114. stxv vs54, 320(SP)
  115. stxv vs55, 336(SP)
  116. stxv vs56, 352(SP)
  117. stxv vs57, 368(SP)
  118. stxv vs58, 384(SP)
  119. stxv vs59, 400(SP)
  120. stxv vs60, 416(SP)
  121. stxv vs61, 432(SP)
  122. stxv vs62, 448(SP)
  123. stxv vs63, 464(SP)
  124. std r0, FLINK_SAVE(SP)
  125. ld LDC, FRAMESLOT(0) + STACKSIZE(SP)
  126. #ifdef TRMMKERNEL
  127. ld OFFSET, FRAMESLOT(1) + STACKSIZE(SP)
  128. #endif
  129. slwi LDC, LDC, ZBASE_SHIFT
  130. /*alpha is stored in f1. convert to single and splat*/
  131. xscvdpspn alpha_r,vs1
  132. xscvdpspn alpha_i,vs2
  133. xxspltw alpha_r,alpha_r,0
  134. xxspltw alpha_i,alpha_i,0
  135. /*load reverse permute mask for big endian
  136. uint128 = 0xc0d0e0f08090a0b0405060700010203
  137. */
  138. lis T2, perm_const2@highest
  139. lis T1, perm_const1@highest
  140. lis T3, save_permute_12@highest
  141. lis T4, save_permute_11@highest
  142. ori T2, T2, perm_const2@higher
  143. ori T1, T1, perm_const1@higher
  144. ori T3, T3, save_permute_12@higher
  145. ori T4, T4, save_permute_11@higher
  146. rldicr T2, T2, 32, 31
  147. rldicr T1, T1, 32, 31
  148. rldicr T3, T3, 32, 31
  149. rldicr T4, T4, 32, 31
  150. oris T2, T2, perm_const2@h
  151. oris T1, T1, perm_const1@h
  152. oris T3, T3, save_permute_12@h
  153. oris T4, T4, save_permute_11@h
  154. ori T2, T2, perm_const2@l
  155. ori T1, T1, perm_const1@l
  156. ori T3, T3, save_permute_12@l
  157. ori T4, T4, save_permute_11@l
  158. li r0,0
  159. li PRE,512
  160. #if defined(CC) || defined(CR) || defined(RC) || defined(RR)
  161. /*negate for this case as we will use addition -1*(a+b) */
  162. xvnegsp alpha_r,alpha_r
  163. xvnegsp alpha_i,alpha_i
  164. #endif
  165. mtvsrdd permute_mask,T2,T1
  166. mtvsrdd save_permute_1,T3,T4
  167. /*mask is reverse permute so we have to make it inner permute */
  168. xxpermdi permute_mask, permute_mask, permute_mask,2
  169. #include "cgemm_logic_power10.S"
  170. .L999:
  171. lfd f14, 0(SP)
  172. lfd f15, 8(SP)
  173. lfd f16, 16(SP)
  174. lfd f17, 24(SP)
  175. lfd f18, 32(SP)
  176. lfd f19, 40(SP)
  177. lfd f20, 48(SP)
  178. lfd f21, 56(SP)
  179. lfd f22, 64(SP)
  180. lfd f23, 72(SP)
  181. lfd f24, 80(SP)
  182. lfd f25, 88(SP)
  183. lfd f26, 96(SP)
  184. lfd f27, 104(SP)
  185. lfd f28, 112(SP)
  186. lfd f29, 120(SP)
  187. lfd f30, 128(SP)
  188. lfd f31, 136(SP)
  189. ld r31, 144(SP)
  190. ld r30, 152(SP)
  191. ld r29, 160(SP)
  192. ld r28, 168(SP)
  193. ld r27, 176(SP)
  194. ld r26, 184(SP)
  195. ld r25, 192(SP)
  196. ld r24, 200(SP)
  197. ld r23, 208(SP)
  198. ld r22, 216(SP)
  199. ld r21, 224(SP)
  200. ld r20, 232(SP)
  201. ld r19, 240(SP)
  202. ld r18, 248(SP)
  203. ld r17, 256(SP)
  204. ld r16, 264(SP)
  205. ld r15, 272(SP)
  206. ld r14, 280(SP)
  207. ld r0, FLINK_SAVE(SP)
  208. lxv vs52, 288(SP)
  209. lxv vs53, 304(SP)
  210. lxv vs54, 320(SP)
  211. lxv vs55, 336(SP)
  212. lxv vs56, 352(SP)
  213. lxv vs57, 368(SP)
  214. lxv vs58, 384(SP)
  215. lxv vs59, 400(SP)
  216. mtlr r0
  217. lxv vs60, 416(SP)
  218. lxv vs61, 432(SP)
  219. lxv vs62, 448(SP)
  220. lxv vs63, 464(SP)
  221. addi SP, SP, STACKSIZE
  222. blr
  223. EPILOGUE
  224. #endif