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.

ctrmm_kernel_8x4_power8.S 10 kB

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