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_kernel_8x2_power8.S 12 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /***************************************************************************
  2. Copyright (c) 2013-2016, 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. /**************************************************************************************
  28. * 2016/04/22 Werner Saar (wernsaar@googlemail.com)
  29. * BLASTEST : OK
  30. * CTEST : OK
  31. * TEST : OK
  32. * LAPACK-TEST : OK
  33. **************************************************************************************/
  34. /***************************************************************************
  35. Copyright (c) 2013-2016, The OpenBLAS Project
  36. All rights reserved.
  37. Redistribution and use in source and binary forms, with or without
  38. modification, are permitted provided that the following conditions are
  39. met:
  40. 1. Redistributions of source code must retain the above copyright
  41. notice, this list of conditions and the following disclaimer.
  42. 2. Redistributions in binary form must reproduce the above copyright
  43. notice, this list of conditions and the following disclaimer in
  44. the documentation and/or other materials provided with the
  45. distribution.
  46. 3. Neither the name of the OpenBLAS project nor the names of
  47. its contributors may be used to endorse or promote products
  48. derived from this software without specific prior written permission.
  49. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  50. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  51. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  52. ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  53. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  54. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  55. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  56. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  57. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  58. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. *****************************************************************************/
  60. /**************************************************************************************
  61. * 2016/04/22 Werner Saar (wernsaar@googlemail.com)
  62. * BLASTEST : OK
  63. * CTEST : OK
  64. * TEST : OK
  65. * LAPACK-TEST : OK
  66. **************************************************************************************/
  67. /*********************************************************************/
  68. /* Copyright 2009, 2010 The University of Texas at Austin. */
  69. /* All rights reserved. */
  70. /* */
  71. /* Redistribution and use in source and binary forms, with or */
  72. /* without modification, are permitted provided that the following */
  73. /* conditions are met: */
  74. /* */
  75. /* 1. Redistributions of source code must retain the above */
  76. /* copyright notice, this list of conditions and the following */
  77. /* disclaimer. */
  78. /* */
  79. /* 2. Redistributions in binary form must reproduce the above */
  80. /* copyright notice, this list of conditions and the following */
  81. /* disclaimer in the documentation and/or other materials */
  82. /* provided with the distribution. */
  83. /* */
  84. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  85. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  86. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  87. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  88. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  89. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  90. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  91. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  92. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  93. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  94. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  95. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  96. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  97. /* POSSIBILITY OF SUCH DAMAGE. */
  98. /* */
  99. /* The views and conclusions contained in the software and */
  100. /* documentation are those of the authors and should not be */
  101. /* interpreted as representing official policies, either expressed */
  102. /* or implied, of The University of Texas at Austin. */
  103. /*********************************************************************/
  104. #define ASSEMBLER
  105. #include "common.h"
  106. #include "def_vsx.h"
  107. #ifndef __64BIT__
  108. #define LOAD lwz
  109. #else
  110. #define LOAD ld
  111. #endif
  112. #ifdef __64BIT__
  113. #define STACKSIZE 32000
  114. #define ALPHA_R_SP 296(SP)
  115. #define ALPHA_I_SP 304(SP)
  116. #define FZERO 312(SP)
  117. #else
  118. #define STACKSIZE 256
  119. #define ALPHA_R_SP 224(SP)
  120. #define ALPHA_I_SP 232(SP)
  121. #define FZERO 240(SP)
  122. #endif
  123. #define M r3
  124. #define N r4
  125. #define K r5
  126. #ifdef linux
  127. #ifndef __64BIT__
  128. #define A r6
  129. #define B r7
  130. #define C r8
  131. #define LDC r9
  132. #define OFFSET r10
  133. #else
  134. #define A r8
  135. #define B r9
  136. #define C r10
  137. #define LDC r6
  138. #define OFFSET r7
  139. #endif
  140. #endif
  141. #if defined(_AIX) || defined(__APPLE__)
  142. #if !defined(__64BIT__) && defined(DOUBLE)
  143. #define A r10
  144. #define B r6
  145. #define C r7
  146. #define LDC r8
  147. #define OFFSET r9
  148. #else
  149. #define A r8
  150. #define B r9
  151. #define C r10
  152. #define LDC r6
  153. #define OFFSET r7
  154. #endif
  155. #endif
  156. #define o0 0
  157. #define alpha_r vs30
  158. #define alpha_i vs31
  159. #define FRAMEPOINTER r12
  160. #define BBUFFER r14
  161. #define L r15
  162. #define ALPHA r16
  163. #define o24 r17
  164. #define T2 r19
  165. #define BBO r20
  166. #define o8 r21
  167. #define I r22
  168. #define J r23
  169. #define AO r24
  170. #define BO r25
  171. #define CO r26
  172. #define o16 r27
  173. #define o32 r28
  174. #define o48 r29
  175. #define PRE r30
  176. #define T1 r31
  177. #ifndef NEEDPARAM
  178. PROLOGUE
  179. PROFCODE
  180. mr FRAMEPOINTER, SP
  181. addi SP, SP, -STACKSIZE
  182. addi SP, SP, -STACKSIZE
  183. addi SP, SP, -STACKSIZE
  184. addi SP, SP, -STACKSIZE
  185. li r0, 0
  186. stfd f14, 0(SP)
  187. stfd f15, 8(SP)
  188. stfd f16, 16(SP)
  189. stfd f17, 24(SP)
  190. stfd f18, 32(SP)
  191. stfd f19, 40(SP)
  192. stfd f20, 48(SP)
  193. stfd f21, 56(SP)
  194. stfd f22, 64(SP)
  195. stfd f23, 72(SP)
  196. stfd f24, 80(SP)
  197. stfd f25, 88(SP)
  198. stfd f26, 96(SP)
  199. stfd f27, 104(SP)
  200. stfd f28, 112(SP)
  201. stfd f29, 120(SP)
  202. stfd f30, 128(SP)
  203. stfd f31, 136(SP)
  204. #ifdef __64BIT__
  205. std r31, 144(SP)
  206. std r30, 152(SP)
  207. std r29, 160(SP)
  208. std r28, 168(SP)
  209. std r27, 176(SP)
  210. std r26, 184(SP)
  211. std r25, 192(SP)
  212. std r24, 200(SP)
  213. std r23, 208(SP)
  214. std r22, 216(SP)
  215. std r21, 224(SP)
  216. std r20, 232(SP)
  217. std r19, 240(SP)
  218. std r18, 248(SP)
  219. std r17, 256(SP)
  220. std r16, 264(SP)
  221. std r15, 272(SP)
  222. std r14, 280(SP)
  223. #else
  224. stw r31, 144(SP)
  225. stw r30, 148(SP)
  226. stw r29, 152(SP)
  227. stw r28, 156(SP)
  228. stw r27, 160(SP)
  229. stw r26, 164(SP)
  230. stw r25, 168(SP)
  231. stw r24, 172(SP)
  232. stw r23, 176(SP)
  233. stw r22, 180(SP)
  234. stw r21, 184(SP)
  235. stw r20, 188(SP)
  236. stw r19, 192(SP)
  237. stw r18, 196(SP)
  238. stw r17, 200(SP)
  239. stw r16, 204(SP)
  240. stw r15, 208(SP)
  241. #endif
  242. stfd f1, ALPHA_R_SP
  243. stfd f2, ALPHA_I_SP
  244. stw r0, FZERO
  245. #ifdef linux
  246. #ifdef __64BIT__
  247. ld LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  248. #endif
  249. #endif
  250. #if defined(_AIX) || defined(__APPLE__)
  251. #ifdef __64BIT__
  252. ld LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  253. #else
  254. #ifdef DOUBLE
  255. lwz B, FRAMESLOT(0) + 0(FRAMEPOINTER)
  256. lwz C, FRAMESLOT(1) + 0(FRAMEPOINTER)
  257. lwz LDC, FRAMESLOT(2) + 0(FRAMEPOINTER)
  258. #else
  259. lwz LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  260. #endif
  261. #endif
  262. #endif
  263. #ifdef TRMMKERNEL
  264. #if defined(linux) && defined(__64BIT__)
  265. ld OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  266. #endif
  267. #if defined(_AIX) || defined(__APPLE__)
  268. #ifdef __64BIT__
  269. ld OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  270. #else
  271. #ifdef DOUBLE
  272. lwz OFFSET, FRAMESLOT(3) + 0(FRAMEPOINTER)
  273. #else
  274. lwz OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  275. #endif
  276. #endif
  277. #endif
  278. #if defined(TRMMKERNEL) && !defined(LEFT)
  279. neg KK, OFFSET
  280. #endif
  281. #endif
  282. #include "zgemm_macros_8x2_power8.S"
  283. cmpwi cr0, M, 0
  284. ble L999
  285. cmpwi cr0, N, 0
  286. ble L999
  287. cmpwi cr0, K, 0
  288. ble L999
  289. slwi LDC, LDC, ZBASE_SHIFT
  290. li PRE, 512
  291. li o8 , 8
  292. li o16 , 16
  293. li o24 , 24
  294. li o32 , 32
  295. li o48 , 48
  296. addi BBUFFER, SP, 512+4096
  297. li T1, -4096
  298. and BBUFFER, BBUFFER, T1
  299. #ifdef __64BIT__
  300. addi ALPHA, SP, 296
  301. #else
  302. addi ALPHA, SP, 224
  303. #endif
  304. lxsdx alpha_r, 0, ALPHA
  305. lxsdx alpha_i, o8, ALPHA
  306. .align 4
  307. #include "zgemm_logic_8x2_power8.S"
  308. L999:
  309. addi r3, 0, 0
  310. lfd f14, 0(SP)
  311. lfd f15, 8(SP)
  312. lfd f16, 16(SP)
  313. lfd f17, 24(SP)
  314. lfd f18, 32(SP)
  315. lfd f19, 40(SP)
  316. lfd f20, 48(SP)
  317. lfd f21, 56(SP)
  318. lfd f22, 64(SP)
  319. lfd f23, 72(SP)
  320. lfd f24, 80(SP)
  321. lfd f25, 88(SP)
  322. lfd f26, 96(SP)
  323. lfd f27, 104(SP)
  324. lfd f28, 112(SP)
  325. lfd f29, 120(SP)
  326. lfd f30, 128(SP)
  327. lfd f31, 136(SP)
  328. #ifdef __64BIT__
  329. ld r31, 144(SP)
  330. ld r30, 152(SP)
  331. ld r29, 160(SP)
  332. ld r28, 168(SP)
  333. ld r27, 176(SP)
  334. ld r26, 184(SP)
  335. ld r25, 192(SP)
  336. ld r24, 200(SP)
  337. ld r23, 208(SP)
  338. ld r22, 216(SP)
  339. ld r21, 224(SP)
  340. ld r20, 232(SP)
  341. ld r19, 240(SP)
  342. ld r18, 248(SP)
  343. ld r17, 256(SP)
  344. ld r16, 264(SP)
  345. ld r15, 272(SP)
  346. ld r14, 280(SP)
  347. #else
  348. lwz r31, 144(SP)
  349. lwz r30, 148(SP)
  350. lwz r29, 152(SP)
  351. lwz r28, 156(SP)
  352. lwz r27, 160(SP)
  353. lwz r26, 164(SP)
  354. lwz r25, 168(SP)
  355. lwz r24, 172(SP)
  356. lwz r23, 176(SP)
  357. lwz r22, 180(SP)
  358. lwz r21, 184(SP)
  359. lwz r20, 188(SP)
  360. lwz r19, 192(SP)
  361. lwz r18, 196(SP)
  362. lwz r17, 200(SP)
  363. lwz r16, 204(SP)
  364. lwz r15, 208(SP)
  365. #endif
  366. addi SP, SP, STACKSIZE
  367. addi SP, SP, STACKSIZE
  368. addi SP, SP, STACKSIZE
  369. addi SP, SP, STACKSIZE
  370. blr
  371. EPILOGUE
  372. #endif