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.

dot_atom.S 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. leaq (, INCX, SIZE), INCX
  57. pxor %xmm0, %xmm0
  58. leaq (, INCY, SIZE), INCY
  59. pxor %xmm1, %xmm1
  60. pxor %xmm2, %xmm2
  61. cmpq $0, N
  62. pxor %xmm3, %xmm3
  63. jle .L999
  64. cmpq $SIZE, INCX
  65. jne .L50
  66. cmpq $SIZE, INCY
  67. jne .L50
  68. movq N, %rax
  69. sarq $3, %rax
  70. jle .L14
  71. movsd 0 * SIZE(X), %xmm4
  72. movsd 0 * SIZE(Y), %xmm8
  73. movsd 1 * SIZE(X), %xmm5
  74. movsd 1 * SIZE(Y), %xmm9
  75. movsd 2 * SIZE(X), %xmm6
  76. mulsd %xmm8, %xmm4
  77. movsd 2 * SIZE(Y), %xmm10
  78. mulsd %xmm9, %xmm5
  79. movsd 3 * SIZE(X), %xmm7
  80. mulsd %xmm10, %xmm6
  81. movsd 3 * SIZE(Y), %xmm11
  82. mulsd %xmm11, %xmm7
  83. decq %rax
  84. jle .L12
  85. ALIGN_3
  86. .L11:
  87. #ifdef PREFETCH
  88. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  89. #endif
  90. addsd %xmm4, %xmm0
  91. movsd 4 * SIZE(X), %xmm4
  92. addsd %xmm5, %xmm1
  93. movsd 4 * SIZE(Y), %xmm8
  94. addsd %xmm6, %xmm2
  95. movsd 5 * SIZE(X), %xmm5
  96. addsd %xmm7, %xmm3
  97. movsd 5 * SIZE(Y), %xmm9
  98. movsd 6 * SIZE(X), %xmm6
  99. mulsd %xmm8, %xmm4
  100. movsd 6 * SIZE(Y), %xmm10
  101. mulsd %xmm9, %xmm5
  102. movsd 7 * SIZE(X), %xmm7
  103. mulsd %xmm10, %xmm6
  104. movsd 7 * SIZE(Y), %xmm11
  105. mulsd %xmm11, %xmm7
  106. #ifdef PREFETCH
  107. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(Y)
  108. #endif
  109. addsd %xmm4, %xmm0
  110. movsd 8 * SIZE(X), %xmm4
  111. addsd %xmm5, %xmm1
  112. movsd 8 * SIZE(Y), %xmm8
  113. addsd %xmm6, %xmm2
  114. movsd 9 * SIZE(X), %xmm5
  115. addsd %xmm7, %xmm3
  116. movsd 9 * SIZE(Y), %xmm9
  117. movsd 10 * SIZE(X), %xmm6
  118. mulsd %xmm8, %xmm4
  119. movsd 10 * SIZE(Y), %xmm10
  120. mulsd %xmm9, %xmm5
  121. movsd 11 * SIZE(X), %xmm7
  122. mulsd %xmm10, %xmm6
  123. movsd 11 * SIZE(Y), %xmm11
  124. mulsd %xmm11, %xmm7
  125. addq $8 * SIZE, X
  126. addq $8 * SIZE, Y
  127. decq %rax
  128. jg .L11
  129. ALIGN_3
  130. .L12:
  131. addsd %xmm4, %xmm0
  132. movsd 4 * SIZE(X), %xmm4
  133. addsd %xmm5, %xmm1
  134. movsd 4 * SIZE(Y), %xmm8
  135. addsd %xmm6, %xmm2
  136. movsd 5 * SIZE(X), %xmm5
  137. addsd %xmm7, %xmm3
  138. movsd 5 * SIZE(Y), %xmm9
  139. movsd 6 * SIZE(X), %xmm6
  140. mulsd %xmm8, %xmm4
  141. movsd 6 * SIZE(Y), %xmm10
  142. mulsd %xmm9, %xmm5
  143. movsd 7 * SIZE(X), %xmm7
  144. mulsd %xmm10, %xmm6
  145. movsd 7 * SIZE(Y), %xmm11
  146. mulsd %xmm11, %xmm7
  147. addsd %xmm4, %xmm0
  148. addsd %xmm5, %xmm1
  149. addsd %xmm6, %xmm2
  150. addsd %xmm7, %xmm3
  151. addq $ 8 * SIZE, X
  152. addq $ 8 * SIZE, Y
  153. ALIGN_3
  154. .L14:
  155. testq $7, N
  156. jle .L999
  157. testq $4, N
  158. jle .L16
  159. movsd 0 * SIZE(X), %xmm4
  160. movsd 0 * SIZE(Y), %xmm8
  161. movsd 1 * SIZE(X), %xmm5
  162. movsd 1 * SIZE(Y), %xmm9
  163. movsd 2 * SIZE(X), %xmm6
  164. mulsd %xmm8, %xmm4
  165. movsd 2 * SIZE(Y), %xmm10
  166. mulsd %xmm9, %xmm5
  167. movsd 3 * SIZE(X), %xmm7
  168. mulsd %xmm10, %xmm6
  169. movsd 3 * SIZE(Y), %xmm11
  170. mulsd %xmm11, %xmm7
  171. addsd %xmm4, %xmm0
  172. addsd %xmm5, %xmm1
  173. addsd %xmm6, %xmm2
  174. addsd %xmm7, %xmm3
  175. addq $4 * SIZE, X
  176. addq $4 * SIZE, Y
  177. ALIGN_3
  178. .L16:
  179. testq $2, N
  180. jle .L17
  181. movsd 0 * SIZE(X), %xmm4
  182. movsd 0 * SIZE(Y), %xmm8
  183. movsd 1 * SIZE(X), %xmm5
  184. movsd 1 * SIZE(Y), %xmm9
  185. mulsd %xmm8, %xmm4
  186. mulsd %xmm9, %xmm5
  187. addsd %xmm4, %xmm0
  188. addsd %xmm5, %xmm1
  189. addq $2 * SIZE, X
  190. addq $2 * SIZE, Y
  191. ALIGN_3
  192. .L17:
  193. testq $1, N
  194. jle .L999
  195. movsd 0 * SIZE(X), %xmm4
  196. movsd 0 * SIZE(Y), %xmm8
  197. mulsd %xmm8, %xmm4
  198. addsd %xmm4, %xmm0
  199. jmp .L999
  200. ALIGN_3
  201. .L50:
  202. movq N, %rax
  203. sarq $2, %rax
  204. jle .L55
  205. ALIGN_3
  206. .L53:
  207. movsd 0 * SIZE(X), %xmm4
  208. addq INCX, X
  209. mulsd 0 * SIZE(Y), %xmm4
  210. addq INCY, Y
  211. movsd 0 * SIZE(X), %xmm5
  212. addq INCX, X
  213. mulsd 0 * SIZE(Y), %xmm5
  214. addq INCY, Y
  215. movsd 0 * SIZE(X), %xmm6
  216. addq INCX, X
  217. mulsd 0 * SIZE(Y), %xmm6
  218. addq INCY, Y
  219. movsd 0 * SIZE(X), %xmm7
  220. addq INCX, X
  221. mulsd 0 * SIZE(Y), %xmm7
  222. addq INCY, Y
  223. addsd %xmm4, %xmm0
  224. addsd %xmm5, %xmm1
  225. addsd %xmm6, %xmm2
  226. addsd %xmm7, %xmm3
  227. decq %rax
  228. jg .L53
  229. ALIGN_3
  230. .L55:
  231. movq N, %rax
  232. andq $3, %rax
  233. jle .L999
  234. ALIGN_3
  235. .L56:
  236. movsd 0 * SIZE(X), %xmm4
  237. addq INCX, X
  238. mulsd 0 * SIZE(Y), %xmm4
  239. addq INCY, Y
  240. addsd %xmm4, %xmm0
  241. decq %rax
  242. jg .L56
  243. ALIGN_3
  244. .L999:
  245. addsd %xmm1, %xmm0
  246. addsd %xmm3, %xmm2
  247. addsd %xmm2, %xmm0
  248. RESTOREREGISTERS
  249. ret
  250. EPILOGUE