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.

zgemv_n_atom.S 11 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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. #ifdef ATOM
  41. #define PREFETCH prefetchnta
  42. #define PREFETCHW prefetcht0
  43. #define PREFETCHSIZE (8 * 6)
  44. #endif
  45. #define STACKSIZE 16
  46. #define M 4 + STACKSIZE(%esp)
  47. #define N 8 + STACKSIZE(%esp)
  48. #define ALPHA_R 16 + STACKSIZE(%esp)
  49. #define ALPHA_I 24 + STACKSIZE(%esp)
  50. #define A 32 + STACKSIZE(%esp)
  51. #define STACK_LDA 36 + STACKSIZE(%esp)
  52. #define STACK_X 40 + STACKSIZE(%esp)
  53. #define STACK_INCX 44 + STACKSIZE(%esp)
  54. #define Y 48 + STACKSIZE(%esp)
  55. #define STACK_INCY 52 + STACKSIZE(%esp)
  56. #define BUFFER 56 + STACKSIZE(%esp)
  57. #define I %eax
  58. #define J %ebx
  59. #define INCX %ecx
  60. #define INCY J
  61. #define A1 %esi
  62. #define X %edx
  63. #define Y1 %edi
  64. #define LDA %ebp
  65. #if !defined(CONJ) && !defined(XCONJ)
  66. #define ADD1 addsd
  67. #define ADD2 addsd
  68. #define ADD3 subsd
  69. #define ADD4 addsd
  70. #endif
  71. #if defined(CONJ) && !defined(XCONJ)
  72. #define ADD1 addsd
  73. #define ADD2 addsd
  74. #define ADD3 addsd
  75. #define ADD4 subsd
  76. #endif
  77. #if !defined(CONJ) && defined(XCONJ)
  78. #define ADD1 addsd
  79. #define ADD2 subsd
  80. #define ADD3 addsd
  81. #define ADD4 addsd
  82. #endif
  83. #if defined(CONJ) && defined(XCONJ)
  84. #define ADD1 addsd
  85. #define ADD2 subsd
  86. #define ADD3 subsd
  87. #define ADD4 subsd
  88. #endif
  89. PROLOGUE
  90. pushl %ebp
  91. pushl %edi
  92. pushl %esi
  93. pushl %ebx
  94. PROFCODE
  95. movl STACK_LDA, LDA
  96. movl STACK_X, X
  97. movl STACK_INCX, INCX
  98. sall $ZBASE_SHIFT, INCX
  99. sall $ZBASE_SHIFT, LDA
  100. subl $-16 * SIZE, A
  101. cmpl $0, N
  102. jle .L999
  103. cmpl $0, M
  104. jle .L999
  105. movl BUFFER, Y1
  106. movl N, J
  107. pxor %xmm7, %xmm7
  108. movl M, %eax
  109. addl $8, %eax
  110. sarl $3, %eax
  111. ALIGN_3
  112. .L01:
  113. movapd %xmm7, 0 * SIZE(Y1)
  114. movapd %xmm7, 2 * SIZE(Y1)
  115. movapd %xmm7, 4 * SIZE(Y1)
  116. movapd %xmm7, 6 * SIZE(Y1)
  117. movapd %xmm7, 8 * SIZE(Y1)
  118. movapd %xmm7, 10 * SIZE(Y1)
  119. movapd %xmm7, 12 * SIZE(Y1)
  120. movapd %xmm7, 14 * SIZE(Y1)
  121. subl $-16 * SIZE, Y1
  122. decl %eax
  123. jg .L01
  124. ALIGN_3
  125. .L10:
  126. movl BUFFER, Y1
  127. addl $16 * SIZE, Y1
  128. movl A, A1
  129. addl LDA, A
  130. movsd 0 * SIZE(X), %xmm6
  131. movsd 1 * SIZE(X), %xmm7
  132. addl INCX, X
  133. movapd %xmm6, %xmm2
  134. mulsd ALPHA_R, %xmm6
  135. mulsd ALPHA_I, %xmm2
  136. movapd %xmm7, %xmm3
  137. mulsd ALPHA_I, %xmm3
  138. mulsd ALPHA_R, %xmm7
  139. #ifndef XCONJ
  140. subsd %xmm3, %xmm6
  141. addsd %xmm2, %xmm7
  142. #else
  143. addsd %xmm3, %xmm6
  144. subsd %xmm2, %xmm7
  145. #endif
  146. movsd -16 * SIZE(Y1), %xmm0
  147. movsd -15 * SIZE(Y1), %xmm1
  148. ALIGN_3
  149. movl M, I
  150. sarl $2, I
  151. jle .L15
  152. movsd -16 * SIZE(A1), %xmm2
  153. movsd -15 * SIZE(A1), %xmm3
  154. movapd %xmm2, %xmm4
  155. mulsd %xmm6, %xmm2
  156. mulsd %xmm7, %xmm4
  157. decl I
  158. jle .L14
  159. ALIGN_3
  160. .L13:
  161. #ifdef PREFETCH
  162. PREFETCH (PREFETCHSIZE + 0) * SIZE(A1)
  163. #endif
  164. movapd %xmm3, %xmm5
  165. mulsd %xmm7, %xmm3
  166. ADD1 %xmm2, %xmm0
  167. movsd -14 * SIZE(A1), %xmm2
  168. mulsd %xmm6, %xmm5
  169. ADD2 %xmm4, %xmm1
  170. movapd %xmm2, %xmm4
  171. mulsd %xmm6, %xmm2
  172. ADD3 %xmm3, %xmm0
  173. movsd -13 * SIZE(A1), %xmm3
  174. ADD4 %xmm5, %xmm1
  175. mulsd %xmm7, %xmm4
  176. movlpd %xmm0, -16 * SIZE(Y1)
  177. movsd -14 * SIZE(Y1), %xmm0
  178. movlpd %xmm1, -15 * SIZE(Y1)
  179. movsd -13 * SIZE(Y1), %xmm1
  180. movapd %xmm3, %xmm5
  181. mulsd %xmm7, %xmm3
  182. ADD1 %xmm2, %xmm0
  183. movsd -12 * SIZE(A1), %xmm2
  184. mulsd %xmm6, %xmm5
  185. ADD2 %xmm4, %xmm1
  186. movapd %xmm2, %xmm4
  187. mulsd %xmm6, %xmm2
  188. ADD3 %xmm3, %xmm0
  189. movsd -11 * SIZE(A1), %xmm3
  190. mulsd %xmm7, %xmm4
  191. ADD4 %xmm5, %xmm1
  192. movlpd %xmm0, -14 * SIZE(Y1)
  193. movsd -12 * SIZE(Y1), %xmm0
  194. movlpd %xmm1, -13 * SIZE(Y1)
  195. movsd -11 * SIZE(Y1), %xmm1
  196. movapd %xmm3, %xmm5
  197. mulsd %xmm7, %xmm3
  198. ADD1 %xmm2, %xmm0
  199. movsd -10 * SIZE(A1), %xmm2
  200. mulsd %xmm6, %xmm5
  201. ADD2 %xmm4, %xmm1
  202. movapd %xmm2, %xmm4
  203. mulsd %xmm6, %xmm2
  204. ADD3 %xmm3, %xmm0
  205. movsd -9 * SIZE(A1), %xmm3
  206. ADD4 %xmm5, %xmm1
  207. mulsd %xmm7, %xmm4
  208. movlpd %xmm0, -12 * SIZE(Y1)
  209. movsd -10 * SIZE(Y1), %xmm0
  210. movlpd %xmm1, -11 * SIZE(Y1)
  211. movsd -9 * SIZE(Y1), %xmm1
  212. movapd %xmm3, %xmm5
  213. mulsd %xmm7, %xmm3
  214. ADD1 %xmm2, %xmm0
  215. movsd -8 * SIZE(A1), %xmm2
  216. mulsd %xmm6, %xmm5
  217. ADD2 %xmm4, %xmm1
  218. movapd %xmm2, %xmm4
  219. mulsd %xmm6, %xmm2
  220. ADD3 %xmm3, %xmm0
  221. movsd -7 * SIZE(A1), %xmm3
  222. mulsd %xmm7, %xmm4
  223. ADD4 %xmm5, %xmm1
  224. movlpd %xmm0, -10 * SIZE(Y1)
  225. movsd -8 * SIZE(Y1), %xmm0
  226. movlpd %xmm1, -9 * SIZE(Y1)
  227. movsd -7 * SIZE(Y1), %xmm1
  228. subl $-8 * SIZE, A1
  229. subl $-8 * SIZE, Y1
  230. subl $1, I
  231. BRANCH
  232. jg .L13
  233. ALIGN_3
  234. .L14:
  235. movapd %xmm3, %xmm5
  236. mulsd %xmm7, %xmm3
  237. ADD1 %xmm2, %xmm0
  238. movsd -14 * SIZE(A1), %xmm2
  239. mulsd %xmm6, %xmm5
  240. ADD2 %xmm4, %xmm1
  241. movapd %xmm2, %xmm4
  242. mulsd %xmm6, %xmm2
  243. ADD3 %xmm3, %xmm0
  244. movsd -13 * SIZE(A1), %xmm3
  245. ADD4 %xmm5, %xmm1
  246. mulsd %xmm7, %xmm4
  247. movlpd %xmm0, -16 * SIZE(Y1)
  248. movsd -14 * SIZE(Y1), %xmm0
  249. movlpd %xmm1, -15 * SIZE(Y1)
  250. movsd -13 * SIZE(Y1), %xmm1
  251. movapd %xmm3, %xmm5
  252. mulsd %xmm7, %xmm3
  253. ADD1 %xmm2, %xmm0
  254. movsd -12 * SIZE(A1), %xmm2
  255. mulsd %xmm6, %xmm5
  256. ADD2 %xmm4, %xmm1
  257. movapd %xmm2, %xmm4
  258. mulsd %xmm6, %xmm2
  259. ADD3 %xmm3, %xmm0
  260. movsd -11 * SIZE(A1), %xmm3
  261. mulsd %xmm7, %xmm4
  262. ADD4 %xmm5, %xmm1
  263. movlpd %xmm0, -14 * SIZE(Y1)
  264. movsd -12 * SIZE(Y1), %xmm0
  265. movlpd %xmm1, -13 * SIZE(Y1)
  266. movsd -11 * SIZE(Y1), %xmm1
  267. movapd %xmm3, %xmm5
  268. mulsd %xmm7, %xmm3
  269. ADD1 %xmm2, %xmm0
  270. movsd -10 * SIZE(A1), %xmm2
  271. mulsd %xmm6, %xmm5
  272. ADD2 %xmm4, %xmm1
  273. movapd %xmm2, %xmm4
  274. mulsd %xmm6, %xmm2
  275. ADD3 %xmm3, %xmm0
  276. movsd -9 * SIZE(A1), %xmm3
  277. ADD4 %xmm5, %xmm1
  278. mulsd %xmm7, %xmm4
  279. movlpd %xmm0, -12 * SIZE(Y1)
  280. movsd -10 * SIZE(Y1), %xmm0
  281. movlpd %xmm1, -11 * SIZE(Y1)
  282. movsd -9 * SIZE(Y1), %xmm1
  283. movapd %xmm3, %xmm5
  284. mulsd %xmm7, %xmm3
  285. ADD1 %xmm2, %xmm0
  286. mulsd %xmm6, %xmm5
  287. ADD2 %xmm4, %xmm1
  288. ADD3 %xmm3, %xmm0
  289. ADD4 %xmm5, %xmm1
  290. movlpd %xmm0, -10 * SIZE(Y1)
  291. movsd -8 * SIZE(Y1), %xmm0
  292. movlpd %xmm1, -9 * SIZE(Y1)
  293. movsd -7 * SIZE(Y1), %xmm1
  294. subl $-8 * SIZE, A1
  295. subl $-8 * SIZE, Y1
  296. ALIGN_3
  297. .L15:
  298. testl $2, M
  299. je .L17
  300. movsd -16 * SIZE(A1), %xmm2
  301. movsd -15 * SIZE(A1), %xmm3
  302. movapd %xmm2, %xmm4
  303. mulsd %xmm6, %xmm2
  304. mulsd %xmm7, %xmm4
  305. movapd %xmm3, %xmm5
  306. mulsd %xmm7, %xmm3
  307. ADD1 %xmm2, %xmm0
  308. movsd -14 * SIZE(A1), %xmm2
  309. mulsd %xmm6, %xmm5
  310. ADD2 %xmm4, %xmm1
  311. movapd %xmm2, %xmm4
  312. mulsd %xmm6, %xmm2
  313. ADD3 %xmm3, %xmm0
  314. movsd -13 * SIZE(A1), %xmm3
  315. ADD4 %xmm5, %xmm1
  316. mulsd %xmm7, %xmm4
  317. movlpd %xmm0, -16 * SIZE(Y1)
  318. movsd -14 * SIZE(Y1), %xmm0
  319. movlpd %xmm1, -15 * SIZE(Y1)
  320. movsd -13 * SIZE(Y1), %xmm1
  321. movapd %xmm3, %xmm5
  322. mulsd %xmm7, %xmm3
  323. ADD1 %xmm2, %xmm0
  324. mulsd %xmm6, %xmm5
  325. ADD2 %xmm4, %xmm1
  326. ADD3 %xmm3, %xmm0
  327. ADD4 %xmm5, %xmm1
  328. movlpd %xmm0, -14 * SIZE(Y1)
  329. movsd -12 * SIZE(Y1), %xmm0
  330. movlpd %xmm1, -13 * SIZE(Y1)
  331. movsd -11 * SIZE(Y1), %xmm1
  332. addl $4 * SIZE, A1
  333. addl $4 * SIZE, Y1
  334. ALIGN_3
  335. .L17:
  336. testl $1, M
  337. je .L19
  338. movsd -16 * SIZE(A1), %xmm2
  339. movsd -15 * SIZE(A1), %xmm3
  340. movapd %xmm2, %xmm4
  341. mulsd %xmm6, %xmm2
  342. mulsd %xmm7, %xmm4
  343. movapd %xmm3, %xmm5
  344. mulsd %xmm7, %xmm3
  345. ADD1 %xmm2, %xmm0
  346. mulsd %xmm6, %xmm5
  347. ADD2 %xmm4, %xmm1
  348. ADD3 %xmm3, %xmm0
  349. ADD4 %xmm5, %xmm1
  350. movlpd %xmm0, -16 * SIZE(Y1)
  351. movlpd %xmm1, -15 * SIZE(Y1)
  352. ALIGN_3
  353. .L19:
  354. decl J
  355. jg .L10
  356. ALIGN_4
  357. .L990:
  358. movl Y, Y1
  359. movl BUFFER, X
  360. movl STACK_INCY, INCY
  361. movl Y1, A1
  362. sall $ZBASE_SHIFT, INCY
  363. movl M, %eax
  364. sarl $2, %eax
  365. jle .L994
  366. ALIGN_3
  367. .L992:
  368. movsd 0 * SIZE(Y1), %xmm0
  369. movsd 1 * SIZE(Y1), %xmm1
  370. addl INCY, Y1
  371. movsd 0 * SIZE(Y1), %xmm2
  372. movsd 1 * SIZE(Y1), %xmm3
  373. addl INCY, Y1
  374. movsd 0 * SIZE(Y1), %xmm4
  375. movsd 1 * SIZE(Y1), %xmm5
  376. addl INCY, Y1
  377. movsd 0 * SIZE(Y1), %xmm6
  378. movsd 1 * SIZE(Y1), %xmm7
  379. addl INCY, Y1
  380. addsd 0 * SIZE(X), %xmm0
  381. addsd 1 * SIZE(X), %xmm1
  382. addsd 2 * SIZE(X), %xmm2
  383. addsd 3 * SIZE(X), %xmm3
  384. addsd 4 * SIZE(X), %xmm4
  385. addsd 5 * SIZE(X), %xmm5
  386. addsd 6 * SIZE(X), %xmm6
  387. addsd 7 * SIZE(X), %xmm7
  388. movlpd %xmm0, 0 * SIZE(A1)
  389. movlpd %xmm1, 1 * SIZE(A1)
  390. addl INCY, A1
  391. movlpd %xmm2, 0 * SIZE(A1)
  392. movlpd %xmm3, 1 * SIZE(A1)
  393. addl INCY, A1
  394. movlpd %xmm4, 0 * SIZE(A1)
  395. movlpd %xmm5, 1 * SIZE(A1)
  396. addl INCY, A1
  397. movlpd %xmm6, 0 * SIZE(A1)
  398. movlpd %xmm7, 1 * SIZE(A1)
  399. addl INCY, A1
  400. addl $8 * SIZE, X
  401. decl %eax
  402. jg .L992
  403. ALIGN_3
  404. .L994:
  405. testl $2, M
  406. jle .L996
  407. movsd 0 * SIZE(Y1), %xmm0
  408. movsd 1 * SIZE(Y1), %xmm1
  409. addl INCY, Y1
  410. movsd 0 * SIZE(Y1), %xmm2
  411. movsd 1 * SIZE(Y1), %xmm3
  412. addl INCY, Y1
  413. addsd 0 * SIZE(X), %xmm0
  414. addsd 1 * SIZE(X), %xmm1
  415. addsd 2 * SIZE(X), %xmm2
  416. addsd 3 * SIZE(X), %xmm3
  417. movlpd %xmm0, 0 * SIZE(A1)
  418. movlpd %xmm1, 1 * SIZE(A1)
  419. addl INCY, A1
  420. movlpd %xmm2, 0 * SIZE(A1)
  421. movlpd %xmm3, 1 * SIZE(A1)
  422. addl INCY, A1
  423. addl $4 * SIZE, X
  424. ALIGN_3
  425. .L996:
  426. testl $1, M
  427. jle .L999
  428. movsd 0 * SIZE(Y1), %xmm0
  429. movsd 1 * SIZE(Y1), %xmm1
  430. addsd 0 * SIZE(X), %xmm0
  431. addsd 1 * SIZE(X), %xmm1
  432. movlpd %xmm0, 0 * SIZE(A1)
  433. movlpd %xmm1, 1 * SIZE(A1)
  434. ALIGN_3
  435. .L999:
  436. popl %ebx
  437. popl %esi
  438. popl %edi
  439. popl %ebp
  440. ret
  441. EPILOGUE

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.