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.

xgemm3m_kernel_2x2.S 15 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #define ASSEMBLER
  39. #include "common.h"
  40. #define M ARG1
  41. #define N ARG2
  42. #define K ARG3
  43. #define A ARG4
  44. #define B ARG5
  45. #define C ARG6
  46. #define LDC %r10
  47. #define I %r12
  48. #define J %r13
  49. #define AO %r14
  50. #define BO %r15
  51. #define CO %rbp
  52. #define KK %r11
  53. #define KKK 48(%rsp)
  54. #define STACKSIZE 64
  55. #define ALPHA_R 8 + STACKSIZE(%rsp)
  56. #define ALPHA_I 24 + STACKSIZE(%rsp)
  57. #define OFFSET 48 + STACKSIZE(%rsp)
  58. #ifdef OPTERON
  59. #define PREFETCH prefetch
  60. #define PREFETCHW prefetchw
  61. #else
  62. #define PREFETCH prefetcht0
  63. #define PREFETCHW prefetcht0
  64. #endif
  65. #define PREFETCHSIZE (5 + 4 * 10)
  66. #if defined(OS_LINUX) && defined(CORE_BARCELONA)
  67. .align 32768
  68. #endif
  69. PROLOGUE
  70. PROFCODE
  71. subq $STACKSIZE, %rsp
  72. movq %rbx, 0(%rsp)
  73. movq %rbp, 8(%rsp)
  74. movq %r12, 16(%rsp)
  75. movq %r13, 24(%rsp)
  76. movq %r14, 32(%rsp)
  77. movq %r15, 40(%rsp)
  78. movq 40 + STACKSIZE(%rsp), LDC
  79. #if defined(TRMMKERNEL) && !defined(LEFT)
  80. movq OFFSET, %rax
  81. negq %rax
  82. movq %rax, KK
  83. #endif
  84. addq $8 * SIZE, A
  85. addq $8 * SIZE, B
  86. salq $ZBASE_SHIFT, LDC
  87. movq N, %rax
  88. sarq $1, %rax
  89. movq %rax, J
  90. je .L30
  91. ALIGN_4
  92. .L01:
  93. #if defined(TRMMKERNEL) && defined(LEFT)
  94. movq OFFSET, %rax
  95. movq %rax, KK
  96. #endif
  97. movq A, AO
  98. movq C, CO
  99. leaq (, LDC, 2), %rax
  100. addq %rax, C
  101. movq M, I
  102. sarq $1, I
  103. je .L20
  104. ALIGN_4
  105. .L11:
  106. #if !defined(TRMMKERNEL) || \
  107. (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  108. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  109. movq B, BO
  110. #else
  111. movq KK, %rax
  112. salq $BASE_SHIFT, %rax
  113. leaq (AO, %rax, 2), AO
  114. leaq (B, %rax, 2), BO
  115. #endif
  116. fldz
  117. fldz
  118. fldz
  119. fldz
  120. #if defined(HAVE_3DNOW)
  121. prefetchw 2 * SIZE(CO)
  122. prefetchw 2 * SIZE(CO, LDC, 1)
  123. #elif defined(HAVE_SSE)
  124. prefetchnta 2 * SIZE(CO)
  125. prefetchnta 2 * SIZE(CO, LDC, 1)
  126. #endif
  127. #ifndef TRMMKERNEL
  128. movq K, %rax
  129. #elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
  130. movq K, %rax
  131. subq KK, %rax
  132. movq %rax, KKK
  133. #else
  134. movq KK, %rax
  135. #ifdef LEFT
  136. addq $2, %rax
  137. #else
  138. addq $2, %rax
  139. #endif
  140. movq %rax, KKK
  141. #endif
  142. sarq $2, %rax
  143. je .L15
  144. ALIGN_4
  145. .L12:
  146. PREFETCH (PREFETCHSIZE + 0) * SIZE(AO)
  147. FLD -8 * SIZE(AO)
  148. FLD -8 * SIZE(BO)
  149. fld %st(1)
  150. fmul %st(1), %st
  151. faddp %st, %st(3)
  152. FLD -7 * SIZE(BO)
  153. fmul %st, %st(2)
  154. FLD -7 * SIZE(AO)
  155. fmul %st, %st(2)
  156. fmulp %st, %st(1)
  157. faddp %st, %st(6)
  158. faddp %st, %st(3)
  159. faddp %st, %st(3)
  160. FLD -6 * SIZE(AO)
  161. FLD -6 * SIZE(BO)
  162. fld %st(1)
  163. fmul %st(1), %st
  164. faddp %st, %st(3)
  165. FLD -5 * SIZE(BO)
  166. fmul %st, %st(2)
  167. FLD -5 * SIZE(AO)
  168. fmul %st, %st(2)
  169. fmulp %st, %st(1)
  170. faddp %st, %st(6)
  171. faddp %st, %st(3)
  172. faddp %st, %st(3)
  173. PREFETCH (PREFETCHSIZE + 4) * SIZE(AO)
  174. FLD -4 * SIZE(AO)
  175. FLD -4 * SIZE(BO)
  176. fld %st(1)
  177. fmul %st(1), %st
  178. faddp %st, %st(3)
  179. FLD -3 * SIZE(BO)
  180. fmul %st, %st(2)
  181. FLD -3 * SIZE(AO)
  182. fmul %st, %st(2)
  183. fmulp %st, %st(1)
  184. faddp %st, %st(6)
  185. faddp %st, %st(3)
  186. faddp %st, %st(3)
  187. FLD -2 * SIZE(AO)
  188. FLD -2 * SIZE(BO)
  189. fld %st(1)
  190. fmul %st(1), %st
  191. faddp %st, %st(3)
  192. FLD -1 * SIZE(BO)
  193. fmul %st, %st(2)
  194. FLD -1 * SIZE(AO)
  195. fmul %st, %st(2)
  196. fmulp %st, %st(1)
  197. faddp %st, %st(6)
  198. faddp %st, %st(3)
  199. faddp %st, %st(3)
  200. addq $8 * SIZE,AO
  201. addq $8 * SIZE,BO
  202. decq %rax
  203. jne .L12
  204. ALIGN_4
  205. .L15:
  206. #ifndef TRMMKERNEL
  207. movq K, %rax
  208. #else
  209. movq KKK, %rax
  210. #endif
  211. and $3, %rax
  212. je .L18
  213. ALIGN_4
  214. .L16:
  215. FLD -8 * SIZE(AO)
  216. FLD -8 * SIZE(BO)
  217. fld %st(1)
  218. fmul %st(1), %st
  219. faddp %st, %st(3)
  220. FLD -7 * SIZE(BO)
  221. fmul %st, %st(2)
  222. FLD -7 * SIZE(AO)
  223. fmul %st, %st(2)
  224. fmulp %st, %st(1)
  225. faddp %st, %st(6)
  226. faddp %st, %st(3)
  227. faddp %st, %st(3)
  228. addq $2 * SIZE,AO
  229. addq $2 * SIZE,BO
  230. decq %rax
  231. jne .L16
  232. ALIGN_4
  233. .L18:
  234. #ifndef TRMMKERNEL
  235. FLD ALPHA_I
  236. FLD ALPHA_R
  237. fld %st(2)
  238. fmul %st(1), %st
  239. FLD 0 * SIZE(CO)
  240. faddp %st, %st(1)
  241. FST 0 * SIZE(CO)
  242. fld %st(3)
  243. fmul %st(1), %st
  244. FLD 2 * SIZE(CO)
  245. faddp %st, %st(1)
  246. FST 2 * SIZE(CO)
  247. fld %st(4)
  248. fmul %st(1), %st
  249. FLD 0 * SIZE(CO, LDC)
  250. faddp %st, %st(1)
  251. FST 0 * SIZE(CO, LDC)
  252. fmul %st(5), %st
  253. FLD 2 * SIZE(CO, LDC)
  254. faddp %st, %st(1)
  255. FST 2 * SIZE(CO, LDC)
  256. fmul %st, %st(1)
  257. fmul %st, %st(2)
  258. fmul %st, %st(3)
  259. fmulp %st, %st(4)
  260. FLD 1 * SIZE(CO)
  261. faddp %st, %st(1)
  262. FST 1 * SIZE(CO)
  263. FLD 3 * SIZE(CO)
  264. faddp %st, %st(1)
  265. FST 3 * SIZE(CO)
  266. FLD 1 * SIZE(CO, LDC)
  267. faddp %st, %st(1)
  268. FST 1 * SIZE(CO, LDC)
  269. FLD 3 * SIZE(CO, LDC)
  270. faddp %st, %st(1)
  271. FST 3 * SIZE(CO, LDC)
  272. #else
  273. FST 0 * SIZE(CO)
  274. FST 1 * SIZE(CO)
  275. FST 0 * SIZE(CO, LDC)
  276. FST 1 * SIZE(CO, LDC)
  277. #endif
  278. #if (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  279. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  280. movq K, %rax
  281. subq KKK, %rax
  282. salq $BASE_SHIFT, %rax
  283. leaq (AO, %rax, 2), AO
  284. leaq (BO, %rax, 2), BO
  285. #endif
  286. #if defined(TRMMKERNEL) && defined(LEFT)
  287. addq $2, KK
  288. #endif
  289. addq $4 * SIZE, CO
  290. decq I
  291. jne .L11
  292. ALIGN_4
  293. .L20:
  294. movq M, %rax
  295. andq $1, %rax
  296. je .L29
  297. ALIGN_4
  298. .L21:
  299. #if !defined(TRMMKERNEL) || \
  300. (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  301. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  302. movq B, BO
  303. #else
  304. movq KK, %rax
  305. salq $BASE_SHIFT, %rax
  306. leaq (AO, %rax, 1), AO
  307. leaq ( B, %rax, 2), BO
  308. #endif
  309. fldz
  310. fldz
  311. #ifndef TRMMKERNEL
  312. movq K, %rax
  313. #elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
  314. movq K, %rax
  315. subq KK, %rax
  316. movq %rax, KKK
  317. #else
  318. movq KK, %rax
  319. #ifdef LEFT
  320. addq $1, %rax
  321. #else
  322. addq $2, %rax
  323. #endif
  324. movq %rax, KKK
  325. #endif
  326. sarq $2, %rax
  327. je .L25
  328. ALIGN_4
  329. .L22:
  330. PREFETCH (PREFETCHSIZE + 0) * SIZE(AO)
  331. FLD -8 * SIZE(AO)
  332. FLD -8 * SIZE(BO)
  333. fmul %st(1), %st
  334. faddp %st, %st(2)
  335. FLD -7 * SIZE(BO)
  336. fmulp %st, %st(1)
  337. faddp %st, %st(2)
  338. FLD -7 * SIZE(AO)
  339. FLD -6 * SIZE(BO)
  340. fmul %st(1), %st
  341. faddp %st, %st(2)
  342. FLD -5 * SIZE(BO)
  343. fmulp %st, %st(1)
  344. faddp %st, %st(2)
  345. FLD -6 * SIZE(AO)
  346. FLD -4 * SIZE(BO)
  347. fmul %st(1), %st
  348. faddp %st, %st(2)
  349. FLD -3 * SIZE(BO)
  350. fmulp %st, %st(1)
  351. faddp %st, %st(2)
  352. FLD -5 * SIZE(AO)
  353. FLD -2 * SIZE(BO)
  354. fmul %st(1), %st
  355. faddp %st, %st(2)
  356. FLD -1 * SIZE(BO)
  357. fmulp %st, %st(1)
  358. faddp %st, %st(2)
  359. addq $4 * SIZE,AO
  360. addq $8 * SIZE,BO
  361. decq %rax
  362. jne .L22
  363. ALIGN_4
  364. .L25:
  365. #ifndef TRMMKERNEL
  366. movq K, %rax
  367. #else
  368. movq KKK, %rax
  369. #endif
  370. and $3, %rax
  371. je .L28
  372. ALIGN_4
  373. .L26:
  374. FLD -8 * SIZE(AO)
  375. FLD -8 * SIZE(BO)
  376. fmul %st(1), %st
  377. faddp %st, %st(2)
  378. FLD -7 * SIZE(BO)
  379. fmulp %st, %st(1)
  380. faddp %st, %st(2)
  381. addq $1 * SIZE,AO
  382. addq $2 * SIZE,BO
  383. decq %rax
  384. jne .L26
  385. ALIGN_4
  386. .L28:
  387. #ifndef TRMMKERNEL
  388. FLD ALPHA_I
  389. FLD ALPHA_R
  390. fld %st(2)
  391. fmul %st(1), %st
  392. FLD 0 * SIZE(CO)
  393. faddp %st, %st(1)
  394. FST 0 * SIZE(CO)
  395. fmul %st(3), %st
  396. FLD 0 * SIZE(CO, LDC)
  397. faddp %st, %st(1)
  398. FST 0 * SIZE(CO, LDC)
  399. fmul %st, %st(1)
  400. fmulp %st, %st(2)
  401. FLD 1 * SIZE(CO)
  402. faddp %st, %st(1)
  403. FST 1 * SIZE(CO)
  404. FLD 1 * SIZE(CO, LDC)
  405. faddp %st, %st(1)
  406. FST 1 * SIZE(CO, LDC)
  407. #else
  408. FST 0 * SIZE(CO)
  409. FST 0 * SIZE(CO, LDC)
  410. #endif
  411. #if (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  412. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  413. movq K, %rax
  414. subq KKK, %rax
  415. salq $BASE_SHIFT, %rax
  416. leaq (AO, %rax, 1), AO
  417. leaq (BO, %rax, 2), BO
  418. #endif
  419. #if defined(TRMMKERNEL) && defined(LEFT)
  420. addq $1, KK
  421. #endif
  422. addq $1 * SIZE, CO
  423. ALIGN_4
  424. .L29:
  425. #if defined(TRMMKERNEL) && !defined(LEFT)
  426. addq $2, KK
  427. #endif
  428. movq BO, B
  429. decq J
  430. jne .L01
  431. ALIGN_4
  432. .L30:
  433. movq N, %rax
  434. testq $1, %rax
  435. je .L999
  436. #if defined(TRMMKERNEL) && defined(LEFT)
  437. movq OFFSET, %rax
  438. movq %rax, KK
  439. #endif
  440. movq A, AO
  441. movq C, CO
  442. addq LDC, C
  443. movq M, I
  444. sarq $1, I
  445. je .L40
  446. ALIGN_4
  447. .L31:
  448. #if !defined(TRMMKERNEL) || \
  449. (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  450. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  451. movq B, BO
  452. #else
  453. movq KK, %rax
  454. salq $BASE_SHIFT, %rax
  455. leaq (AO, %rax, 2), AO
  456. leaq ( B, %rax, 1), BO
  457. #endif
  458. fldz
  459. fldz
  460. #if defined(HAVE_3DNOW)
  461. prefetchw 2 * SIZE(CO)
  462. #elif defined(HAVE_SSE)
  463. prefetchnta 2 * SIZE(CO)
  464. #endif
  465. #ifndef TRMMKERNEL
  466. movq K, %rax
  467. #elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
  468. movq K, %rax
  469. subq KK, %rax
  470. movq %rax, KKK
  471. #else
  472. movq KK, %rax
  473. #ifdef LEFT
  474. addq $2, %rax
  475. #else
  476. addq $1, %rax
  477. #endif
  478. movq %rax, KKK
  479. #endif
  480. sarq $2, %rax
  481. je .L35
  482. ALIGN_4
  483. .L32:
  484. PREFETCH (PREFETCHSIZE + 0) * SIZE(AO)
  485. FLD -8 * SIZE(BO)
  486. FLD -8 * SIZE(AO)
  487. fmul %st(1), %st
  488. faddp %st, %st(2)
  489. FLD -7 * SIZE(AO)
  490. fmulp %st, %st(1)
  491. faddp %st, %st(2)
  492. FLD -7 * SIZE(BO)
  493. FLD -6 * SIZE(AO)
  494. fmul %st(1), %st
  495. faddp %st, %st(2)
  496. FLD -5 * SIZE(AO)
  497. fmulp %st, %st(1)
  498. faddp %st, %st(2)
  499. FLD -6 * SIZE(BO)
  500. FLD -4 * SIZE(AO)
  501. fmul %st(1), %st
  502. faddp %st, %st(2)
  503. FLD -3 * SIZE(AO)
  504. fmulp %st, %st(1)
  505. faddp %st, %st(2)
  506. FLD -5 * SIZE(BO)
  507. FLD -2 * SIZE(AO)
  508. fmul %st(1), %st
  509. faddp %st, %st(2)
  510. FLD -1 * SIZE(AO)
  511. fmulp %st, %st(1)
  512. faddp %st, %st(2)
  513. addq $8 * SIZE,AO
  514. addq $4 * SIZE,BO
  515. decq %rax
  516. jne .L32
  517. ALIGN_4
  518. .L35:
  519. #ifndef TRMMKERNEL
  520. movq K, %rax
  521. #else
  522. movq KKK, %rax
  523. #endif
  524. and $3, %rax
  525. je .L38
  526. ALIGN_4
  527. .L36:
  528. FLD -8 * SIZE(BO)
  529. FLD -8 * SIZE(AO)
  530. fmul %st(1), %st
  531. faddp %st, %st(2)
  532. FLD -7 * SIZE(AO)
  533. fmulp %st, %st(1)
  534. faddp %st, %st(2)
  535. addq $2 * SIZE,AO
  536. addq $1 * SIZE,BO
  537. decq %rax
  538. jne .L36
  539. ALIGN_4
  540. .L38:
  541. #ifndef TRMMKERNEL
  542. FLD ALPHA_I
  543. FLD ALPHA_R
  544. fld %st(2)
  545. fmul %st(1), %st
  546. FLD 0 * SIZE(CO)
  547. faddp %st, %st(1)
  548. FST 0 * SIZE(CO)
  549. fmul %st(3), %st
  550. FLD 2 * SIZE(CO)
  551. faddp %st, %st(1)
  552. FST 2 * SIZE(CO)
  553. fmul %st, %st(1)
  554. fmulp %st, %st(2)
  555. FLD 1 * SIZE(CO)
  556. faddp %st, %st(1)
  557. FST 1 * SIZE(CO)
  558. FLD 3 * SIZE(CO)
  559. faddp %st, %st(1)
  560. FST 3 * SIZE(CO)
  561. #else
  562. FST 0 * SIZE(CO)
  563. FST 1 * SIZE(CO)
  564. #endif
  565. #if (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  566. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  567. movq K, %rax
  568. subq KKK, %rax
  569. salq $BASE_SHIFT, %rax
  570. leaq (AO, %rax, 2), AO
  571. leaq (BO, %rax, 1), BO
  572. #endif
  573. #if defined(TRMMKERNEL) && defined(LEFT)
  574. addq $2, KK
  575. #endif
  576. addq $4 * SIZE, CO
  577. decq I
  578. jne .L31
  579. ALIGN_4
  580. .L40:
  581. movq M, %rax
  582. andq $1, %rax
  583. je .L49
  584. ALIGN_4
  585. .L41:
  586. #if !defined(TRMMKERNEL) || \
  587. (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  588. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  589. movq B, BO
  590. #else
  591. movq KK, %rax
  592. salq $BASE_SHIFT, %rax
  593. leaq (AO, %rax, 1), AO
  594. leaq ( B, %rax, 1), BO
  595. #endif
  596. fldz
  597. #ifndef TRMMKERNEL
  598. movq K, %rax
  599. #elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
  600. movq K, %rax
  601. subq KK, %rax
  602. movq %rax, KKK
  603. #else
  604. movq KK, %rax
  605. #ifdef LEFT
  606. addq $1, %rax
  607. #else
  608. addq $1, %rax
  609. #endif
  610. movq %rax, KKK
  611. #endif
  612. sarq $2, %rax
  613. je .L45
  614. ALIGN_4
  615. .L42:
  616. PREFETCH (PREFETCHSIZE + 0) * SIZE(AO)
  617. FLD -8 * SIZE(AO)
  618. FLD -8 * SIZE(BO)
  619. fmulp %st, %st(1)
  620. faddp %st, %st(1)
  621. FLD -7 * SIZE(AO)
  622. FLD -7 * SIZE(BO)
  623. fmulp %st, %st(1)
  624. faddp %st, %st(1)
  625. FLD -6 * SIZE(AO)
  626. FLD -6 * SIZE(BO)
  627. fmulp %st, %st(1)
  628. faddp %st, %st(1)
  629. FLD -5 * SIZE(AO)
  630. FLD -5 * SIZE(BO)
  631. fmulp %st, %st(1)
  632. faddp %st, %st(1)
  633. addq $4 * SIZE,AO
  634. addq $4 * SIZE,BO
  635. decq %rax
  636. jne .L42
  637. ALIGN_4
  638. .L45:
  639. #ifndef TRMMKERNEL
  640. movq K, %rax
  641. #else
  642. movq KKK, %rax
  643. #endif
  644. and $3, %rax
  645. je .L48
  646. ALIGN_4
  647. .L46:
  648. FLD -8 * SIZE(AO)
  649. FLD -8 * SIZE(BO)
  650. fmulp %st, %st(1)
  651. faddp %st, %st(1)
  652. addq $1 * SIZE,AO
  653. addq $1 * SIZE,BO
  654. decq %rax
  655. jne .L46
  656. ALIGN_4
  657. .L48:
  658. #ifndef TRMMKERNEL
  659. FLD ALPHA_I
  660. FLD ALPHA_R
  661. fmul %st(2), %st
  662. FLD 0 * SIZE(CO)
  663. faddp %st, %st(1)
  664. FST 0 * SIZE(CO)
  665. fmulp %st, %st(1)
  666. FLD 1 * SIZE(CO)
  667. faddp %st, %st(1)
  668. FST 1 * SIZE(CO)
  669. #else
  670. FST 0 * SIZE(CO)
  671. #endif
  672. #if (defined(TRMMKERNEL) && defined(LEFT) && defined(TRANSA)) || \
  673. (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
  674. movq K, %rax
  675. subq KKK, %rax
  676. salq $BASE_SHIFT, %rax
  677. leaq (AO, %rax, 1), AO
  678. leaq (BO, %rax, 1), BO
  679. #endif
  680. #if defined(TRMMKERNEL) && defined(LEFT)
  681. addq $1, KK
  682. #endif
  683. addq $1 * SIZE, CO
  684. ALIGN_4
  685. .L49:
  686. #if defined(TRMMKERNEL) && !defined(LEFT)
  687. addq $1, KK
  688. #endif
  689. movq BO, B
  690. ALIGN_4
  691. .L999:
  692. EMMS
  693. movq 0(%rsp), %rbx
  694. movq 8(%rsp), %rbp
  695. movq 16(%rsp), %r12
  696. movq 24(%rsp), %r13
  697. movq 32(%rsp), %r14
  698. movq 40(%rsp), %r15
  699. addq $STACKSIZE, %rsp
  700. ret
  701. EPILOGUE