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.

zdot_atom.S 10 kB

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