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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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 32192
  114. #define ALPHA_R_SP 296+192(SP)
  115. #define ALPHA_I_SP 304+192(SP)
  116. #define FZERO 312+192(SP)
  117. #else
  118. #define STACKSIZE 460
  119. #define ALPHA_R_SP 224+204(SP)
  120. #define ALPHA_I_SP 232+204(SP)
  121. #define FZERO 240+204(SP)
  122. #endif
  123. #define M r3
  124. #define N r4
  125. #define K r5
  126. #if defined(linux) || defined(__FreeBSD__)
  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 VECSAVE r11
  160. #define FRAMEPOINTER r12
  161. #define BBUFFER r14
  162. #define L r15
  163. #define ALPHA r16
  164. #define o24 r17
  165. #define T2 r19
  166. #define BBO r20
  167. #define o8 r21
  168. #define I r22
  169. #define J r23
  170. #define AO r24
  171. #define BO r25
  172. #define CO r26
  173. #define o16 r27
  174. #define o32 r28
  175. #define o48 r29
  176. #define PRE r30
  177. #define T1 r31
  178. #ifndef NEEDPARAM
  179. PROLOGUE
  180. PROFCODE
  181. mr FRAMEPOINTER, SP
  182. addi SP, SP, -STACKSIZE
  183. addi SP, SP, -STACKSIZE
  184. addi SP, SP, -STACKSIZE
  185. addi SP, SP, -STACKSIZE
  186. li r0, 0
  187. stfd f14, 0(SP)
  188. stfd f15, 8(SP)
  189. stfd f16, 16(SP)
  190. stfd f17, 24(SP)
  191. stfd f18, 32(SP)
  192. stfd f19, 40(SP)
  193. stfd f20, 48(SP)
  194. stfd f21, 56(SP)
  195. stfd f22, 64(SP)
  196. stfd f23, 72(SP)
  197. stfd f24, 80(SP)
  198. stfd f25, 88(SP)
  199. stfd f26, 96(SP)
  200. stfd f27, 104(SP)
  201. stfd f28, 112(SP)
  202. stfd f29, 120(SP)
  203. stfd f30, 128(SP)
  204. stfd f31, 136(SP)
  205. #ifdef __64BIT__
  206. std r31, 144(SP)
  207. std r30, 152(SP)
  208. std r29, 160(SP)
  209. std r28, 168(SP)
  210. std r27, 176(SP)
  211. std r26, 184(SP)
  212. std r25, 192(SP)
  213. std r24, 200(SP)
  214. std r23, 208(SP)
  215. std r22, 216(SP)
  216. std r21, 224(SP)
  217. std r20, 232(SP)
  218. std r19, 240(SP)
  219. std r18, 248(SP)
  220. std r17, 256(SP)
  221. std r16, 264(SP)
  222. std r15, 272(SP)
  223. std r14, 280(SP)
  224. addi r11, SP, 288
  225. #else
  226. stw r31, 144(SP)
  227. stw r30, 148(SP)
  228. stw r29, 152(SP)
  229. stw r28, 156(SP)
  230. stw r27, 160(SP)
  231. stw r26, 164(SP)
  232. stw r25, 168(SP)
  233. stw r24, 172(SP)
  234. stw r23, 176(SP)
  235. stw r22, 180(SP)
  236. stw r21, 184(SP)
  237. stw r20, 188(SP)
  238. stw r19, 192(SP)
  239. stw r18, 196(SP)
  240. stw r17, 200(SP)
  241. stw r16, 204(SP)
  242. stw r15, 208(SP)
  243. addi r11, SP, 224
  244. #endif
  245. stvx v20, r11, r0
  246. addi r11, r11, 16
  247. stvx v21, r11, r0
  248. addi r11, r11, 16
  249. stvx v22, r11, r0
  250. addi r11, r11, 16
  251. stvx v23, r11, r0
  252. addi r11, r11, 16
  253. stvx v24, r11, r0
  254. addi r11, r11, 16
  255. stvx v25, r11, r0
  256. addi r11, r11, 16
  257. stvx v26, r11, r0
  258. addi r11, r11, 16
  259. stvx v27, r11, r0
  260. addi r11, r11, 16
  261. stvx v28, r11, r0
  262. addi r11, r11, 16
  263. stvx v29, r11, r0
  264. addi r11, r11, 16
  265. stvx v30, r11, r0
  266. addi r11, r11, 16
  267. stvx v31, r11, r0
  268. li r11,0
  269. stfd f1, ALPHA_R_SP
  270. stfd f2, ALPHA_I_SP
  271. stw r0, FZERO
  272. #if defined(linux) || defined(__FreeBSD__)
  273. #ifdef __64BIT__
  274. ld LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  275. #endif
  276. #endif
  277. #if defined(_AIX) || defined(__APPLE__)
  278. #ifdef __64BIT__
  279. ld LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  280. #else
  281. #ifdef DOUBLE
  282. lwz B, FRAMESLOT(0) + 0(FRAMEPOINTER)
  283. lwz C, FRAMESLOT(1) + 0(FRAMEPOINTER)
  284. lwz LDC, FRAMESLOT(2) + 0(FRAMEPOINTER)
  285. #else
  286. lwz LDC, FRAMESLOT(0) + 0(FRAMEPOINTER)
  287. #endif
  288. #endif
  289. #endif
  290. #ifdef TRMMKERNEL
  291. #if (defined(linux) || defined(__FreeBSD__)) && defined(__64BIT__)
  292. ld OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  293. #endif
  294. #if defined(_AIX) || defined(__APPLE__)
  295. #ifdef __64BIT__
  296. ld OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  297. #else
  298. #ifdef DOUBLE
  299. lwz OFFSET, FRAMESLOT(3) + 0(FRAMEPOINTER)
  300. #else
  301. lwz OFFSET, FRAMESLOT(1) + 0(FRAMEPOINTER)
  302. #endif
  303. #endif
  304. #endif
  305. #if defined(TRMMKERNEL) && !defined(LEFT)
  306. neg KK, OFFSET
  307. #endif
  308. #endif
  309. #include "zgemm_macros_8x2_power8.S"
  310. cmpwi cr0, M, 0
  311. ble L999
  312. cmpwi cr0, N, 0
  313. ble L999
  314. cmpwi cr0, K, 0
  315. ble L999
  316. slwi LDC, LDC, ZBASE_SHIFT
  317. li PRE, 512
  318. li o8 , 8
  319. li o16 , 16
  320. li o24 , 24
  321. li o32 , 32
  322. li o48 , 48
  323. addi BBUFFER, SP, 512+4096
  324. li T1, -4096
  325. and BBUFFER, BBUFFER, T1
  326. #ifdef __64BIT__
  327. addi ALPHA, SP, 296+192
  328. #else
  329. addi ALPHA, SP, 224+192+12
  330. #endif
  331. lxsdx alpha_r, 0, ALPHA
  332. lxsdx alpha_i, o8, ALPHA
  333. .align 4
  334. #include "zgemm_logic_8x2_power8.S"
  335. L999:
  336. addi r3, 0, 0
  337. lfd f14, 0(SP)
  338. lfd f15, 8(SP)
  339. lfd f16, 16(SP)
  340. lfd f17, 24(SP)
  341. lfd f18, 32(SP)
  342. lfd f19, 40(SP)
  343. lfd f20, 48(SP)
  344. lfd f21, 56(SP)
  345. lfd f22, 64(SP)
  346. lfd f23, 72(SP)
  347. lfd f24, 80(SP)
  348. lfd f25, 88(SP)
  349. lfd f26, 96(SP)
  350. lfd f27, 104(SP)
  351. lfd f28, 112(SP)
  352. lfd f29, 120(SP)
  353. lfd f30, 128(SP)
  354. lfd f31, 136(SP)
  355. #ifdef __64BIT__
  356. ld r31, 144(SP)
  357. ld r30, 152(SP)
  358. ld r29, 160(SP)
  359. ld r28, 168(SP)
  360. ld r27, 176(SP)
  361. ld r26, 184(SP)
  362. ld r25, 192(SP)
  363. ld r24, 200(SP)
  364. ld r23, 208(SP)
  365. ld r22, 216(SP)
  366. ld r21, 224(SP)
  367. ld r20, 232(SP)
  368. ld r19, 240(SP)
  369. ld r18, 248(SP)
  370. ld r17, 256(SP)
  371. ld r16, 264(SP)
  372. ld r15, 272(SP)
  373. ld r14, 280(SP)
  374. addi r11, SP, 288
  375. #else
  376. lwz r31, 144(SP)
  377. lwz r30, 148(SP)
  378. lwz r29, 152(SP)
  379. lwz r28, 156(SP)
  380. lwz r27, 160(SP)
  381. lwz r26, 164(SP)
  382. lwz r25, 168(SP)
  383. lwz r24, 172(SP)
  384. lwz r23, 176(SP)
  385. lwz r22, 180(SP)
  386. lwz r21, 184(SP)
  387. lwz r20, 188(SP)
  388. lwz r19, 192(SP)
  389. lwz r18, 196(SP)
  390. lwz r17, 200(SP)
  391. lwz r16, 204(SP)
  392. lwz r15, 208(SP)
  393. addi r11, SP, 224
  394. #endif
  395. lvx v20, r11, r3
  396. addi r11, r11, 16
  397. lvx v21, r11, r3
  398. addi r11, r11, 16
  399. lvx v22, r11, r3
  400. addi r11, r11, 16
  401. lvx v23, r11, r3
  402. addi r11, r11, 16
  403. lvx v24, r11, r3
  404. addi r11, r11, 16
  405. lvx v25, r11, r3
  406. addi r11, r11, 16
  407. lvx v26, r11, r3
  408. addi r11, r11, 16
  409. lvx v27, r11, r3
  410. addi r11, r11, 16
  411. lvx v28, r11, r3
  412. addi r11, r11, 16
  413. lvx v29, r11, r3
  414. addi r11, r11, 16
  415. lvx v30, r11, r3
  416. addi r11, r11, 16
  417. lvx v31, r11, r3
  418. li r11, 0
  419. addi SP, SP, STACKSIZE
  420. addi SP, SP, STACKSIZE
  421. addi SP, SP, STACKSIZE
  422. addi SP, SP, STACKSIZE
  423. blr
  424. EPILOGUE
  425. #endif