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.

sgemm_tcopy_16.S 16 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. /***************************************************************************
  2. Copyright (c) 2019, The OpenBLAS Project
  3. All rights reserved.
  4. *****************************************************************************/
  5. #define ASSEMBLER
  6. #include "common.h"
  7. #define M x0
  8. #define N x1
  9. #define A x2
  10. #define LDA x3
  11. #define B x4
  12. #define M8 x5
  13. #define A01 x6
  14. #define A02 x7
  15. #define A03 x8
  16. #define A04 x9
  17. #define A05 x10
  18. #define A06 x11
  19. #define A07 x12
  20. #define A08 x13
  21. #define B01 x14
  22. #define B02 x15
  23. #define B03 x16
  24. #define B04 x17
  25. #define B00 x22
  26. #define I x18
  27. #define J x19
  28. #define TEMP1 x20
  29. #define A_PREFETCH 256
  30. /**************************************************************************************
  31. * Macro definitions
  32. **************************************************************************************/
  33. .macro SAVE_REGS
  34. add sp, sp, #-(11 * 16)
  35. stp d8, d9, [sp, #(0 * 16)]
  36. stp d10, d11, [sp, #(1 * 16)]
  37. stp d12, d13, [sp, #(2 * 16)]
  38. stp d14, d15, [sp, #(3 * 16)]
  39. stp d16, d17, [sp, #(4 * 16)]
  40. stp x18, x19, [sp, #(5 * 16)]
  41. stp x20, x21, [sp, #(6 * 16)]
  42. stp x22, x23, [sp, #(7 * 16)]
  43. stp x24, x25, [sp, #(8 * 16)]
  44. stp x26, x27, [sp, #(9 * 16)]
  45. str x28, [sp, #(10 * 16)]
  46. .endm
  47. .macro RESTORE_REGS
  48. ldp d8, d9, [sp, #(0 * 16)]
  49. ldp d10, d11, [sp, #(1 * 16)]
  50. ldp d12, d13, [sp, #(2 * 16)]
  51. ldp d14, d15, [sp, #(3 * 16)]
  52. ldp d16, d17, [sp, #(4 * 16)]
  53. ldp x18, x19, [sp, #(5 * 16)]
  54. ldp x20, x21, [sp, #(6 * 16)]
  55. ldp x22, x23, [sp, #(7 * 16)]
  56. ldp x24, x25, [sp, #(8 * 16)]
  57. ldp x26, x27, [sp, #(9 * 16)]
  58. ldr x28, [sp, #(10 * 16)]
  59. add sp, sp, #(11*16)
  60. .endm
  61. /*************************************************************************************************************************/
  62. .macro COPY16x8
  63. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  64. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  65. prfm PLDL1KEEP, [A03, #A_PREFETCH]
  66. prfm PLDL1KEEP, [A04, #A_PREFETCH]
  67. prfm PLDL1KEEP, [A05, #A_PREFETCH]
  68. prfm PLDL1KEEP, [A06, #A_PREFETCH]
  69. prfm PLDL1KEEP, [A07, #A_PREFETCH]
  70. prfm PLDL1KEEP, [A08, #A_PREFETCH]
  71. //prfm PSTL1KEEP, [B00, M8]
  72. ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [A01]
  73. add A01, A01, #64
  74. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B00]
  75. add TEMP1, B00, #64
  76. ld1 {v4.4s, v5.4s, v6.4s, v7.4s}, [A02]
  77. add A02, A02, #64
  78. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [TEMP1]
  79. add TEMP1, TEMP1, #64
  80. ld1 {v8.4s, v9.4s, v10.4s, v11.4s}, [A03]
  81. add A03, A03, #64
  82. st1 {v8.4s, v9.4s, v10.4s, v11.4s}, [TEMP1]
  83. add TEMP1, TEMP1, #64
  84. ld1 {v12.4s, v13.4s, v14.4s, v15.4s}, [A04]
  85. add A04, A04, #64
  86. st1 {v12.4s, v13.4s, v14.4s, v15.4s}, [TEMP1]
  87. add TEMP1, TEMP1, #64
  88. ld1 {v16.4s, v17.4s, v18.4s, v19.4s}, [A05]
  89. add A05, A05, #64
  90. st1 {v16.4s, v17.4s, v18.4s, v19.4s}, [TEMP1]
  91. add TEMP1, TEMP1, #64
  92. ld1 {v20.4s, v21.4s, v22.4s, v23.4s}, [A06]
  93. add A06, A06, #64
  94. st1 {v20.4s, v21.4s, v22.4s, v23.4s}, [TEMP1]
  95. add TEMP1, TEMP1, #64
  96. ld1 {v24.4s, v25.4s, v26.4s, v27.4s}, [A07]
  97. add A07, A07, #64
  98. st1 {v24.4s, v25.4s, v26.4s, v27.4s}, [TEMP1]
  99. add TEMP1, TEMP1, #64
  100. ld1 {v28.4s, v29.4s, v30.4s, v31.4s}, [A08]
  101. add A08, A08, #64
  102. st1 {v28.4s, v29.4s, v30.4s, v31.4s}, [TEMP1]
  103. add TEMP1, TEMP1, #64
  104. add B00, B00, M8
  105. .endm
  106. .macro COPY8x8
  107. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  108. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  109. prfm PLDL1KEEP, [A03, #A_PREFETCH]
  110. prfm PLDL1KEEP, [A04, #A_PREFETCH]
  111. prfm PLDL1KEEP, [A05, #A_PREFETCH]
  112. prfm PLDL1KEEP, [A06, #A_PREFETCH]
  113. prfm PLDL1KEEP, [A07, #A_PREFETCH]
  114. prfm PLDL1KEEP, [A08, #A_PREFETCH]
  115. ldp q0, q1, [A01]
  116. ldp q2, q3, [A02]
  117. add A01, A01, #32
  118. add A02, A02, #32
  119. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B01]
  120. add B01, B01, #64
  121. ldp q4, q5, [A03]
  122. ldp q6, q7, [A04]
  123. add A03, A03, #32
  124. add A04, A04, #32
  125. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [B01]
  126. add B01, B01, #64
  127. ldp q8, q9, [A05]
  128. ldp q10, q11, [A06]
  129. add A05, A05, #32
  130. add A06, A06, #32
  131. st1 {v8.4s, v9.4s, v10.4s, v11.4s}, [B01]
  132. add B01, B01, #64
  133. ldp q12, q13, [A07]
  134. ldp q14, q15, [A08]
  135. add A07, A07, #32
  136. add A08, A08, #32
  137. st1 {v12.4s, v13.4s, v14.4s, v15.4s}, [B01]
  138. add B01, B01, #64
  139. .endm
  140. .macro COPY4x8
  141. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  142. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  143. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  144. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  145. //prfm PLDL1KEEP, [A05, #A_PREFETCH]
  146. //prfm PLDL1KEEP, [A06, #A_PREFETCH]
  147. //prfm PLDL1KEEP, [A07, #A_PREFETCH]
  148. //prfm PLDL1KEEP, [A08, #A_PREFETCH]
  149. ldr q0, [A01]
  150. ldr q1, [A02]
  151. ldr q2, [A03]
  152. ldr q3, [A04]
  153. add A01, A01, #16
  154. add A02, A02, #16
  155. add A03, A03, #16
  156. add A04, A04, #16
  157. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B02]
  158. add B02, B02, #64
  159. ldr q4, [A05]
  160. ldr q5, [A06]
  161. ldr q6, [A07]
  162. ldr q7, [A08]
  163. add A05, A05, #16
  164. add A06, A06, #16
  165. add A07, A07, #16
  166. add A08, A08, #16
  167. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [B02]
  168. add B02, B02, #64
  169. .endm
  170. .macro COPY2x8
  171. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  172. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  173. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  174. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  175. //prfm PLDL1KEEP, [A05, #A_PREFETCH]
  176. //prfm PLDL1KEEP, [A06, #A_PREFETCH]
  177. //prfm PLDL1KEEP, [A07, #A_PREFETCH]
  178. //prfm PLDL1KEEP, [A08, #A_PREFETCH]
  179. ldr d0, [A01]
  180. ldr d1, [A02]
  181. ldr d2, [A03]
  182. ldr d3, [A04]
  183. add A01, A01, #8
  184. add A02, A02, #8
  185. add A03, A03, #8
  186. add A04, A04, #8
  187. stp d0, d1, [B03]
  188. add B03, B03, #16
  189. stp d2, d3, [B03]
  190. add B03, B03, #16
  191. ldr d4, [A05]
  192. ldr d5, [A06]
  193. ldr d6, [A07]
  194. ldr d7, [A08]
  195. add A05, A05, #8
  196. add A06, A06, #8
  197. add A07, A07, #8
  198. add A08, A08, #8
  199. stp d4, d5, [B03]
  200. add B03, B03, #16
  201. stp d6, d7, [B03]
  202. add B03, B03, #16
  203. .endm
  204. .macro COPY1x8
  205. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  206. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  207. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  208. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  209. //prfm PLDL1KEEP, [A05, #A_PREFETCH]
  210. //prfm PLDL1KEEP, [A06, #A_PREFETCH]
  211. //prfm PLDL1KEEP, [A07, #A_PREFETCH]
  212. //prfm PLDL1KEEP, [A08, #A_PREFETCH]
  213. ldr s0, [A01]
  214. ldr s1, [A02]
  215. ldr s2, [A03]
  216. ldr s3, [A04]
  217. add A01, A01, #4
  218. add A02, A02, #4
  219. add A03, A03, #4
  220. add A04, A04, #4
  221. stp s0, s1, [B04]
  222. add B04, B04, #8
  223. stp s2, s3, [B04]
  224. add B04, B04, #8
  225. ldr s4, [A05]
  226. ldr s5, [A06]
  227. ldr s6, [A07]
  228. ldr s7, [A08]
  229. ldr d4, [A05], #8
  230. ldr d5, [A06], #8
  231. ldr d6, [A07], #8
  232. ldr d7, [A08], #8
  233. stp s4, s5, [B04]
  234. add B04, B04, #8
  235. stp s6, s7, [B04]
  236. add B04, B04, #8
  237. .endm
  238. /*************************************************************************************************************************/
  239. .macro COPY16x4
  240. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  241. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  242. prfm PLDL1KEEP, [A03, #A_PREFETCH]
  243. prfm PLDL1KEEP, [A04, #A_PREFETCH]
  244. ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [A01]
  245. add A01, A01, #64
  246. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B00]
  247. add TEMP1, B00, #64
  248. ld1 {v4.4s, v5.4s, v6.4s, v7.4s}, [A02]
  249. add A02, A02, #64
  250. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [TEMP1]
  251. add TEMP1, TEMP1, #64
  252. ld1 {v8.4s, v9.4s, v10.4s, v11.4s}, [A03]
  253. add A03, A03, #64
  254. st1 {v8.4s, v9.4s, v10.4s, v11.4s}, [TEMP1]
  255. add TEMP1, TEMP1, #64
  256. ld1 {v12.4s, v13.4s, v14.4s, v15.4s}, [A04]
  257. add A04, A04, #64
  258. st1 {v12.4s, v13.4s, v14.4s, v15.4s}, [TEMP1]
  259. add B00, B00, M8
  260. .endm
  261. .macro COPY8x4
  262. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  263. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  264. prfm PLDL1KEEP, [A03, #A_PREFETCH]
  265. prfm PLDL1KEEP, [A04, #A_PREFETCH]
  266. ldp q0, q1, [A01]
  267. ldp q2, q3, [A02]
  268. add A01, A01, #32
  269. add A02, A02, #32
  270. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B01]
  271. add B01, B01, #64
  272. ldp q4, q5, [A03]
  273. ldp q6, q7, [A04]
  274. add A03, A03, #32
  275. add A04, A04, #32
  276. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [B01]
  277. add B01, B01, #64
  278. .endm
  279. .macro COPY4x4
  280. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  281. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  282. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  283. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  284. ldr q0, [A01]
  285. ldr q1, [A02]
  286. ldr q2, [A03]
  287. ldr q3, [A04]
  288. add A01, A01, #16
  289. add A02, A02, #16
  290. add A03, A03, #16
  291. add A04, A04, #16
  292. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B02]
  293. add B02, B02, #64
  294. .endm
  295. .macro COPY2x4
  296. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  297. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  298. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  299. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  300. ldr d0, [A01]
  301. ldr d1, [A02]
  302. ldr d2, [A03]
  303. ldr d3, [A04]
  304. add A01, A01, #8
  305. add A02, A02, #8
  306. add A03, A03, #8
  307. add A04, A04, #8
  308. stp d0, d1, [B03]
  309. add B03, B03, #16
  310. stp d2, d3, [B03]
  311. add B03, B03, #16
  312. .endm
  313. .macro COPY1x4
  314. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  315. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  316. //prfm PLDL1KEEP, [A03, #A_PREFETCH]
  317. //prfm PLDL1KEEP, [A04, #A_PREFETCH]
  318. ldr s0, [A01]
  319. ldr s1, [A02]
  320. ldr s2, [A03]
  321. ldr s3, [A04]
  322. add A01, A01, #4
  323. add A02, A02, #4
  324. add A03, A03, #4
  325. add A04, A04, #4
  326. stp s0, s1, [B04]
  327. add B04, B04, #8
  328. stp s2, s3, [B04]
  329. add B04, B04, #8
  330. .endm
  331. /*************************************************************************************************************************/
  332. .macro COPY16x2
  333. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  334. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  335. ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [A01]
  336. add A01, A01, #64
  337. ld1 {v4.4s, v5.4s, v6.4s, v7.4s}, [A02]
  338. add A02, A02, #64
  339. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B00]
  340. add TEMP1, B00, #64
  341. st1 {v4.4s, v5.4s, v6.4s, v7.4s}, [TEMP1]
  342. add B00, B00, M8
  343. .endm
  344. .macro COPY8x2
  345. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  346. prfm PLDL1KEEP, [A02, #A_PREFETCH]
  347. ld1 {v0.4s, v1.4s}, [A01]
  348. ld1 {v2.4s, v3.4s}, [A02]
  349. add A01, A01, #32
  350. add A02, A02, #32
  351. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B01]
  352. add B01, B01, #64
  353. .endm
  354. .macro COPY4x2
  355. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  356. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  357. ldr q0, [A01]
  358. ldr q1, [A02]
  359. add A01, A01, #16
  360. add A02, A02, #16
  361. stp q0, q1, [B02]
  362. add B02, B02, #32
  363. .endm
  364. .macro COPY2x2
  365. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  366. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  367. ldr d0, [A01]
  368. ldr d1, [A02]
  369. add A01, A01, #8
  370. add A02, A02, #8
  371. stp d0, d1, [B03]
  372. add B03, B03, #16
  373. .endm
  374. .macro COPY1x2
  375. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  376. //prfm PLDL1KEEP, [A02, #A_PREFETCH]
  377. ldr s0, [A01]
  378. ldr s1, [A02]
  379. add A01, A01, #4
  380. add A02, A02, #4
  381. stp s0, s1, [B04]
  382. add B04, B04, #8
  383. .endm
  384. /*************************************************************************************************************************/
  385. .macro COPY16x1
  386. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  387. ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [A01]
  388. add A01, A01, #64
  389. st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [B00]
  390. add B00, B00, M8
  391. .endm
  392. .macro COPY8x1
  393. prfm PLDL1KEEP, [A01, #A_PREFETCH]
  394. ldp q0, q1, [A01]
  395. add A01, A01, #32
  396. stp q0, q1, [B01]
  397. add B01, B01, #32
  398. .endm
  399. .macro COPY4x1
  400. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  401. ldr q0, [A01]
  402. add A01, A01, #16
  403. str q0, [B02]
  404. add B02, B02, #16
  405. .endm
  406. .macro COPY2x1
  407. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  408. ldr d0, [A01]
  409. add A01, A01, #8
  410. str d0, [B03]
  411. add B03, B03, #8
  412. .endm
  413. .macro COPY1x1
  414. //prfm PLDL1KEEP, [A01, #A_PREFETCH]
  415. ldr s0, [A01]
  416. add A01, A01, #4
  417. str s0, [B04]
  418. add B04, B04, #4
  419. .endm
  420. /**************************************************************************************
  421. * End of macro definitions
  422. **************************************************************************************/
  423. PROLOGUE
  424. .align 5
  425. SAVE_REGS
  426. lsl LDA, LDA, #2 // LDA = LDA * SIZE
  427. lsl TEMP1, M, #2 // TEMP1 = M * SIZE
  428. and B01 , N , #-16
  429. and B02 , N , #-8
  430. and B03 , N , #-4
  431. and B04 , N , #-2
  432. mul B01, B01, TEMP1
  433. mul B02, B02, TEMP1
  434. mul B03, B03, TEMP1
  435. mul B04, B04, TEMP1
  436. add B01 , B01, B
  437. add B02 , B02, B
  438. add B03 , B03, B
  439. add B04 , B04, B
  440. lsl M8, M, #6 // M8 = M * 16 * SIZE
  441. .Lsgemm_tcopy_L8_BEGIN:
  442. asr J, M, #3 // J = M / 8
  443. cmp J, #0
  444. ble .Lsgemm_tcopy_L4_BEGIN
  445. .align 5
  446. .Lsgemm_tcopy_L8_M16_BEGIN:
  447. mov A01, A
  448. add A02, A01, LDA
  449. add A03, A02, LDA
  450. add A04, A03, LDA
  451. add A05, A04, LDA
  452. add A06, A05, LDA
  453. add A07, A06, LDA
  454. add A08, A07, LDA
  455. add A, A08, LDA
  456. mov B00, B
  457. add B, B00, #512 // B = B + 8 * 16 * SIZE
  458. asr I, N, #4 // I = N / 16
  459. cmp I, #0
  460. ble .Lsgemm_tcopy_L8_M16_40
  461. .align 5
  462. .Lsgemm_tcopy_L8_M16_20:
  463. COPY16x8
  464. subs I , I , #1
  465. bne .Lsgemm_tcopy_L8_M16_20
  466. .Lsgemm_tcopy_L8_M16_40:
  467. tst N , #8
  468. ble .Lsgemm_tcopy_L8_M16_60
  469. COPY8x8
  470. .Lsgemm_tcopy_L8_M16_60:
  471. tst N , #4
  472. ble .Lsgemm_tcopy_L8_M16_80
  473. COPY4x8
  474. .Lsgemm_tcopy_L8_M16_80:
  475. tst N , #2
  476. ble .Lsgemm_tcopy_L8_M16_100
  477. COPY2x8
  478. .Lsgemm_tcopy_L8_M16_100:
  479. tst N, #1
  480. ble .Lsgemm_tcopy_L8_M16_END
  481. COPY1x8
  482. .Lsgemm_tcopy_L8_M16_END:
  483. subs J , J, #1 // j--
  484. bne .Lsgemm_tcopy_L8_M16_BEGIN
  485. /*********************************************************************************************/
  486. .Lsgemm_tcopy_L4_BEGIN:
  487. tst M, #7
  488. ble .Lsgemm_tcopy_L999
  489. tst M, #4
  490. ble .Lsgemm_tcopy_L2_BEGIN
  491. .Lsgemm_tcopy_L4_M16_BEGIN:
  492. mov A01, A
  493. add A02, A01, LDA
  494. add A03, A02, LDA
  495. add A04, A03, LDA
  496. add A, A04, LDA
  497. mov B00, B
  498. add B, B00, #256 // B = B + 4 * 16 * SIZE
  499. asr I, N, #4 // I = N / 16
  500. cmp I, #0
  501. ble .Lsgemm_tcopy_L4_M16_40
  502. .align 5
  503. .Lsgemm_tcopy_L4_M16_20:
  504. COPY16x4
  505. subs I , I , #1
  506. bne .Lsgemm_tcopy_L4_M16_20
  507. .Lsgemm_tcopy_L4_M16_40:
  508. tst N , #8
  509. ble .Lsgemm_tcopy_L4_M16_60
  510. COPY8x4
  511. .Lsgemm_tcopy_L4_M16_60:
  512. tst N , #4
  513. ble .Lsgemm_tcopy_L4_M16_80
  514. COPY4x4
  515. .Lsgemm_tcopy_L4_M16_80:
  516. tst N , #2
  517. ble .Lsgemm_tcopy_L4_M16_100
  518. COPY2x4
  519. .Lsgemm_tcopy_L4_M16_100:
  520. tst N, #1
  521. ble .Lsgemm_tcopy_L4_M16_END
  522. COPY1x4
  523. .Lsgemm_tcopy_L4_M16_END:
  524. /*********************************************************************************************/
  525. .Lsgemm_tcopy_L2_BEGIN:
  526. tst M, #3
  527. ble .Lsgemm_tcopy_L999
  528. tst M, #2
  529. ble .Lsgemm_tcopy_L1_BEGIN
  530. .Lsgemm_tcopy_L2_M16_BEGIN:
  531. mov A01, A
  532. add A02, A01, LDA
  533. add A, A02, LDA
  534. mov B00, B
  535. add B, B00, #128 // B = B + 2 * 16 * SIZE
  536. asr I, N, #4 // I = N / 16
  537. cmp I, #0
  538. ble .Lsgemm_tcopy_L2_M16_40
  539. .align 5
  540. .Lsgemm_tcopy_L2_M16_20:
  541. COPY16x2
  542. subs I , I , #1
  543. bne .Lsgemm_tcopy_L2_M16_20
  544. .Lsgemm_tcopy_L2_M16_40:
  545. tst N , #8
  546. ble .Lsgemm_tcopy_L2_M16_60
  547. COPY8x2
  548. .Lsgemm_tcopy_L2_M16_60:
  549. tst N , #4
  550. ble .Lsgemm_tcopy_L2_M16_80
  551. COPY4x2
  552. .Lsgemm_tcopy_L2_M16_80:
  553. tst N , #2
  554. ble .Lsgemm_tcopy_L2_M16_100
  555. COPY2x2
  556. .Lsgemm_tcopy_L2_M16_100:
  557. tst N , #1
  558. ble .Lsgemm_tcopy_L2_M16_END
  559. COPY1x2
  560. .Lsgemm_tcopy_L2_M16_END:
  561. /*********************************************************************************************/
  562. .Lsgemm_tcopy_L1_BEGIN:
  563. tst M, #1
  564. ble .Lsgemm_tcopy_L999
  565. .Lsgemm_tcopy_L1_M16_BEGIN:
  566. mov A01, A // A01 = A
  567. mov B00, B
  568. asr I, N, #4 // I = M / 16
  569. cmp I, #0
  570. ble .Lsgemm_tcopy_L1_M16_40
  571. .align 5
  572. .Lsgemm_tcopy_L1_M16_20:
  573. COPY16x1
  574. subs I , I , #1
  575. bne .Lsgemm_tcopy_L1_M16_20
  576. .Lsgemm_tcopy_L1_M16_40:
  577. tst N , #8
  578. ble .Lsgemm_tcopy_L1_M16_60
  579. COPY8x1
  580. .Lsgemm_tcopy_L1_M16_60:
  581. tst N , #4
  582. ble .Lsgemm_tcopy_L1_M16_80
  583. COPY4x1
  584. .Lsgemm_tcopy_L1_M16_80:
  585. tst N , #2
  586. ble .Lsgemm_tcopy_L1_M16_100
  587. COPY2x1
  588. .Lsgemm_tcopy_L1_M16_100:
  589. tst N , #1
  590. ble .Lsgemm_tcopy_L1_M16_END
  591. COPY1x1
  592. .Lsgemm_tcopy_L1_M16_END:
  593. .Lsgemm_tcopy_L999:
  594. mov x0, #0 // set return value
  595. RESTORE_REGS
  596. ret
  597. EPILOGUE