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.

axpy_atom.S 10 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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. #ifndef WINDOWS_ABI
  41. #define M ARG1
  42. #define X ARG4
  43. #define INCX ARG5
  44. #define Y ARG6
  45. #define INCY ARG2
  46. #else
  47. #define M ARG1
  48. #define X ARG2
  49. #define INCX ARG3
  50. #define Y ARG4
  51. #define INCY %r10
  52. #endif
  53. #define YY %r11
  54. #define ALPHA %xmm15
  55. #include "l1param.h"
  56. PROLOGUE
  57. PROFCODE
  58. #ifndef WINDOWS_ABI
  59. #ifndef XDOUBLE
  60. movq 8(%rsp), INCY
  61. #else
  62. movq 24(%rsp), INCY
  63. #endif
  64. movaps %xmm0, ALPHA
  65. #else
  66. movaps %xmm3, ALPHA
  67. movq 40(%rsp), X
  68. movq 48(%rsp), INCX
  69. movq 56(%rsp), Y
  70. movq 64(%rsp), INCY
  71. #endif
  72. SAVEREGISTERS
  73. leaq (, INCX, SIZE), INCX
  74. leaq (, INCY, SIZE), INCY
  75. testq M, M
  76. jle .L29
  77. cmpq $SIZE, INCX
  78. jne .L20
  79. cmpq $SIZE, INCY
  80. jne .L20
  81. movq M, %rax
  82. sarq $3, %rax
  83. jle .L13
  84. movsd 0 * SIZE(X), %xmm0
  85. movsd 1 * SIZE(X), %xmm1
  86. movsd 2 * SIZE(X), %xmm2
  87. movsd 3 * SIZE(X), %xmm3
  88. movsd 0 * SIZE(Y), %xmm4
  89. movsd 1 * SIZE(Y), %xmm5
  90. movsd 2 * SIZE(Y), %xmm6
  91. movsd 3 * SIZE(Y), %xmm7
  92. movsd 4 * SIZE(X), %xmm8
  93. mulsd ALPHA, %xmm0
  94. movsd 5 * SIZE(X), %xmm9
  95. mulsd ALPHA, %xmm1
  96. movsd 6 * SIZE(X), %xmm10
  97. mulsd ALPHA, %xmm2
  98. movsd 7 * SIZE(X), %xmm11
  99. mulsd ALPHA, %xmm3
  100. decq %rax
  101. jle .L12
  102. ALIGN_3
  103. .L11:
  104. #ifdef PREFETCH
  105. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  106. #endif
  107. addsd %xmm4, %xmm0
  108. movsd 4 * SIZE(Y), %xmm4
  109. addsd %xmm5, %xmm1
  110. movsd 5 * SIZE(Y), %xmm5
  111. addsd %xmm6, %xmm2
  112. movsd 6 * SIZE(Y), %xmm6
  113. addsd %xmm7, %xmm3
  114. movsd 7 * SIZE(Y), %xmm7
  115. movsd %xmm0, 0 * SIZE(Y)
  116. mulsd ALPHA, %xmm8
  117. movsd 8 * SIZE(X), %xmm0
  118. movsd %xmm1, 1 * SIZE(Y)
  119. mulsd ALPHA, %xmm9
  120. movsd 9 * SIZE(X), %xmm1
  121. movsd %xmm2, 2 * SIZE(Y)
  122. mulsd ALPHA, %xmm10
  123. movsd 10 * SIZE(X), %xmm2
  124. movsd %xmm3, 3 * SIZE(Y)
  125. mulsd ALPHA, %xmm11
  126. movsd 11 * SIZE(X), %xmm3
  127. #ifdef PREFETCHW
  128. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(Y)
  129. #endif
  130. addsd %xmm4, %xmm8
  131. movsd 8 * SIZE(Y), %xmm4
  132. addsd %xmm5, %xmm9
  133. movsd 9 * SIZE(Y), %xmm5
  134. addsd %xmm6, %xmm10
  135. movsd 10 * SIZE(Y), %xmm6
  136. addsd %xmm7, %xmm11
  137. movsd 11 * SIZE(Y), %xmm7
  138. movsd %xmm8, 4 * SIZE(Y)
  139. mulsd ALPHA, %xmm0
  140. movsd 12 * SIZE(X), %xmm8
  141. movsd %xmm9, 5 * SIZE(Y)
  142. mulsd ALPHA, %xmm1
  143. movsd 13 * SIZE(X), %xmm9
  144. movsd %xmm10, 6 * SIZE(Y)
  145. mulsd ALPHA, %xmm2
  146. movsd 14 * SIZE(X), %xmm10
  147. movsd %xmm11, 7 * SIZE(Y)
  148. mulsd ALPHA, %xmm3
  149. movsd 15 * SIZE(X), %xmm11
  150. addq $8 * SIZE, Y
  151. addq $8 * SIZE, X
  152. decq %rax
  153. jg .L11
  154. ALIGN_3
  155. .L12:
  156. addsd %xmm4, %xmm0
  157. movsd 4 * SIZE(Y), %xmm4
  158. addsd %xmm5, %xmm1
  159. movsd 5 * SIZE(Y), %xmm5
  160. addsd %xmm6, %xmm2
  161. movsd 6 * SIZE(Y), %xmm6
  162. addsd %xmm7, %xmm3
  163. movsd 7 * SIZE(Y), %xmm7
  164. movsd %xmm0, 0 * SIZE(Y)
  165. mulsd ALPHA, %xmm8
  166. movsd %xmm1, 1 * SIZE(Y)
  167. mulsd ALPHA, %xmm9
  168. movsd %xmm2, 2 * SIZE(Y)
  169. mulsd ALPHA, %xmm10
  170. movsd %xmm3, 3 * SIZE(Y)
  171. mulsd ALPHA, %xmm11
  172. addsd %xmm4, %xmm8
  173. addsd %xmm5, %xmm9
  174. addsd %xmm6, %xmm10
  175. addsd %xmm7, %xmm11
  176. movsd %xmm8, 4 * SIZE(Y)
  177. movsd %xmm9, 5 * SIZE(Y)
  178. movsd %xmm10, 6 * SIZE(Y)
  179. movsd %xmm11, 7 * SIZE(Y)
  180. addq $8 * SIZE, X
  181. addq $8 * SIZE, Y
  182. ALIGN_3
  183. .L13:
  184. movq M, %rax
  185. andq $4, %rax
  186. jle .L15
  187. ALIGN_3
  188. movsd 0 * SIZE(X), %xmm0
  189. movsd 1 * SIZE(X), %xmm1
  190. movsd 2 * SIZE(X), %xmm2
  191. movsd 3 * SIZE(X), %xmm3
  192. movsd 0 * SIZE(Y), %xmm4
  193. mulsd ALPHA, %xmm0
  194. movsd 1 * SIZE(Y), %xmm5
  195. mulsd ALPHA, %xmm1
  196. movsd 2 * SIZE(Y), %xmm6
  197. mulsd ALPHA, %xmm2
  198. movsd 3 * SIZE(Y), %xmm7
  199. mulsd ALPHA, %xmm3
  200. addsd %xmm4, %xmm0
  201. addsd %xmm5, %xmm1
  202. addsd %xmm6, %xmm2
  203. addsd %xmm7, %xmm3
  204. movsd %xmm0, 0 * SIZE(Y)
  205. movsd %xmm1, 1 * SIZE(Y)
  206. movsd %xmm2, 2 * SIZE(Y)
  207. movsd %xmm3, 3 * SIZE(Y)
  208. addq $4 * SIZE, X
  209. addq $4 * SIZE, Y
  210. ALIGN_3
  211. .L15:
  212. movq M, %rax
  213. andq $2, %rax
  214. jle .L16
  215. ALIGN_3
  216. movsd 0 * SIZE(X), %xmm0
  217. movsd 0 * SIZE(Y), %xmm4
  218. movsd 1 * SIZE(X), %xmm1
  219. movsd 1 * SIZE(Y), %xmm5
  220. mulsd ALPHA, %xmm0
  221. mulsd ALPHA, %xmm1
  222. addsd %xmm4, %xmm0
  223. addsd %xmm5, %xmm1
  224. movsd %xmm0, 0 * SIZE(Y)
  225. movsd %xmm1, 1 * SIZE(Y)
  226. addq $2 * SIZE, X
  227. addq $2 * SIZE, Y
  228. ALIGN_3
  229. .L16:
  230. movq M, %rax
  231. andq $1, %rax
  232. jle .L19
  233. ALIGN_3
  234. movsd 0 * SIZE(X), %xmm0
  235. mulsd ALPHA, %xmm0
  236. addsd 0 * SIZE(Y), %xmm0
  237. movsd %xmm0, 0 * SIZE(Y)
  238. addq $SIZE, Y
  239. ALIGN_3
  240. .L19:
  241. xorq %rax,%rax
  242. RESTOREREGISTERS
  243. ret
  244. ALIGN_3
  245. .L20:
  246. movq Y, YY
  247. movq M, %rax
  248. sarq $3, %rax
  249. jle .L23
  250. movsd (X), %xmm0
  251. addq INCX, X
  252. movsd (X), %xmm1
  253. addq INCX, X
  254. movsd (X), %xmm2
  255. addq INCX, X
  256. movsd (X), %xmm3
  257. addq INCX, X
  258. movsd (Y), %xmm4
  259. addq INCY, Y
  260. movsd (Y), %xmm5
  261. addq INCY, Y
  262. movsd (Y), %xmm6
  263. addq INCY, Y
  264. movsd (Y), %xmm7
  265. addq INCY, Y
  266. movsd (X), %xmm8
  267. addq INCX, X
  268. mulsd ALPHA, %xmm0
  269. movsd (X), %xmm9
  270. addq INCX, X
  271. mulsd ALPHA, %xmm1
  272. movsd (X), %xmm10
  273. addq INCX, X
  274. mulsd ALPHA, %xmm2
  275. movsd (X), %xmm11
  276. addq INCX, X
  277. mulsd ALPHA, %xmm3
  278. decq %rax
  279. jle .L22
  280. ALIGN_3
  281. .L21:
  282. addsd %xmm4, %xmm0
  283. movsd (Y), %xmm4
  284. addq INCY, Y
  285. addsd %xmm5, %xmm1
  286. movsd (Y), %xmm5
  287. addq INCY, Y
  288. addsd %xmm6, %xmm2
  289. movsd (Y), %xmm6
  290. addq INCY, Y
  291. addsd %xmm7, %xmm3
  292. movsd (Y), %xmm7
  293. addq INCY, Y
  294. movsd %xmm0, (YY)
  295. addq INCY, YY
  296. movsd (X), %xmm0
  297. addq INCX, X
  298. mulsd ALPHA, %xmm8
  299. movsd %xmm1, (YY)
  300. addq INCY, YY
  301. movsd (X), %xmm1
  302. addq INCX, X
  303. mulsd ALPHA, %xmm9
  304. movsd %xmm2, (YY)
  305. addq INCY, YY
  306. movsd (X), %xmm2
  307. addq INCX, X
  308. mulsd ALPHA, %xmm10
  309. movsd %xmm3, (YY)
  310. addq INCY, YY
  311. movsd (X), %xmm3
  312. addq INCX, X
  313. mulsd ALPHA, %xmm11
  314. addsd %xmm4, %xmm8
  315. movsd (Y), %xmm4
  316. addq INCY, Y
  317. addsd %xmm5, %xmm9
  318. movsd (Y), %xmm5
  319. addq INCY, Y
  320. addsd %xmm6, %xmm10
  321. movsd (Y), %xmm6
  322. addq INCY, Y
  323. addsd %xmm7, %xmm11
  324. movsd (Y), %xmm7
  325. addq INCY, Y
  326. movsd %xmm8, (YY)
  327. addq INCY, YY
  328. movsd (X), %xmm8
  329. addq INCX, X
  330. mulsd ALPHA, %xmm0
  331. movsd %xmm9, (YY)
  332. addq INCY, YY
  333. movsd (X), %xmm9
  334. addq INCX, X
  335. mulsd ALPHA, %xmm1
  336. movsd %xmm10, (YY)
  337. addq INCY, YY
  338. movsd (X), %xmm10
  339. addq INCX, X
  340. mulsd ALPHA, %xmm2
  341. movsd %xmm11, (YY)
  342. addq INCY, YY
  343. movsd (X), %xmm11
  344. addq INCX, X
  345. mulsd ALPHA, %xmm3
  346. decq %rax
  347. jg .L21
  348. ALIGN_3
  349. .L22:
  350. addsd %xmm4, %xmm0
  351. movsd (Y), %xmm4
  352. addq INCY, Y
  353. addsd %xmm5, %xmm1
  354. movsd (Y), %xmm5
  355. addq INCY, Y
  356. addsd %xmm6, %xmm2
  357. movsd (Y), %xmm6
  358. addq INCY, Y
  359. addsd %xmm7, %xmm3
  360. movsd (Y), %xmm7
  361. addq INCY, Y
  362. movsd %xmm0, (YY)
  363. addq INCY, YY
  364. mulsd ALPHA, %xmm8
  365. movsd %xmm1, (YY)
  366. addq INCY, YY
  367. mulsd ALPHA, %xmm9
  368. movsd %xmm2, (YY)
  369. addq INCY, YY
  370. mulsd ALPHA, %xmm10
  371. movsd %xmm3, (YY)
  372. addq INCY, YY
  373. mulsd ALPHA, %xmm11
  374. addsd %xmm4, %xmm8
  375. addsd %xmm5, %xmm9
  376. addsd %xmm6, %xmm10
  377. addsd %xmm7, %xmm11
  378. movsd %xmm8, (YY)
  379. addq INCY, YY
  380. movsd %xmm9, (YY)
  381. addq INCY, YY
  382. movsd %xmm10, (YY)
  383. addq INCY, YY
  384. movsd %xmm11, (YY)
  385. addq INCY, YY
  386. ALIGN_3
  387. .L23:
  388. movq M, %rax
  389. andq $4, %rax
  390. jle .L25
  391. ALIGN_3
  392. movsd (X), %xmm0
  393. addq INCX, X
  394. movsd (Y), %xmm4
  395. addq INCY, Y
  396. movsd (X), %xmm1
  397. addq INCX, X
  398. movsd (Y), %xmm5
  399. addq INCY, Y
  400. movsd (X), %xmm2
  401. addq INCX, X
  402. mulsd ALPHA, %xmm0
  403. movsd (Y), %xmm6
  404. addq INCY, Y
  405. mulsd ALPHA, %xmm1
  406. movsd (X), %xmm3
  407. addq INCX, X
  408. mulsd ALPHA, %xmm2
  409. movsd (Y), %xmm7
  410. addq INCY, Y
  411. mulsd ALPHA, %xmm3
  412. addsd %xmm4, %xmm0
  413. addsd %xmm5, %xmm1
  414. addsd %xmm6, %xmm2
  415. addsd %xmm7, %xmm3
  416. movsd %xmm0, (YY)
  417. addq INCY, YY
  418. movsd %xmm1, (YY)
  419. addq INCY, YY
  420. movsd %xmm2, (YY)
  421. addq INCY, YY
  422. movsd %xmm3, (YY)
  423. addq INCY, YY
  424. ALIGN_3
  425. .L25:
  426. movq M, %rax
  427. andq $2, %rax
  428. jle .L26
  429. ALIGN_3
  430. movsd (X), %xmm0
  431. addq INCX, X
  432. movsd (Y), %xmm4
  433. addq INCY, Y
  434. movsd (X), %xmm1
  435. addq INCX, X
  436. movsd (Y), %xmm5
  437. addq INCY, Y
  438. mulsd ALPHA, %xmm0
  439. mulsd ALPHA, %xmm1
  440. addsd %xmm4, %xmm0
  441. addsd %xmm5, %xmm1
  442. movsd %xmm0, (YY)
  443. addq INCY, YY
  444. movsd %xmm1, (YY)
  445. addq INCY, YY
  446. ALIGN_3
  447. .L26:
  448. movq M, %rax
  449. andq $1, %rax
  450. jle .L29
  451. ALIGN_3
  452. movsd (X), %xmm0
  453. mulsd ALPHA, %xmm0
  454. addsd (Y), %xmm0
  455. movsd %xmm0, (YY)
  456. addq $SIZE, Y
  457. ALIGN_3
  458. .L29:
  459. xorq %rax, %rax
  460. RESTOREREGISTERS
  461. ret
  462. EPILOGUE