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.

zamax_atom.S 7.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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 /* rdi */
  41. #define X ARG2 /* rsi */
  42. #define INCX ARG3 /* rdx */
  43. #define I %rax
  44. #ifdef USE_MIN
  45. #define maxsd minsd
  46. #endif
  47. #include "l1param.h"
  48. PROLOGUE
  49. PROFCODE
  50. SAVEREGISTERS
  51. xorps %xmm0, %xmm0
  52. salq $ZBASE_SHIFT, INCX
  53. testq M, M
  54. jle .L999
  55. testq INCX, INCX
  56. jle .L999
  57. pcmpeqb %xmm15, %xmm15
  58. psrlq $1, %xmm15
  59. movsd 0 * SIZE(X), %xmm0
  60. movsd 1 * SIZE(X), %xmm4
  61. addq INCX, X
  62. andps %xmm15, %xmm0
  63. andps %xmm15, %xmm4
  64. addsd %xmm4, %xmm0
  65. decq M
  66. jle .L999
  67. movaps %xmm0, %xmm1
  68. cmpq $2 * SIZE, INCX
  69. jne .L20
  70. movq M, I
  71. sarq $2, I
  72. jle .L15
  73. movsd 0 * SIZE(X), %xmm4
  74. movsd 1 * SIZE(X), %xmm5
  75. movsd 2 * SIZE(X), %xmm6
  76. movsd 3 * SIZE(X), %xmm7
  77. movsd 4 * SIZE(X), %xmm8
  78. andps %xmm15, %xmm4
  79. movsd 5 * SIZE(X), %xmm9
  80. andps %xmm15, %xmm5
  81. movsd 6 * SIZE(X), %xmm10
  82. addsd %xmm4, %xmm5
  83. movsd 7 * SIZE(X), %xmm11
  84. decq I
  85. jle .L13
  86. ALIGN_4
  87. .L12:
  88. #ifdef PREFETCH
  89. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  90. #endif
  91. andps %xmm15, %xmm6
  92. movsd 8 * SIZE(X), %xmm4
  93. andps %xmm15, %xmm7
  94. addsd %xmm6, %xmm7
  95. movsd 10 * SIZE(X), %xmm6
  96. maxsd %xmm5, %xmm0
  97. movsd 9 * SIZE(X), %xmm5
  98. andps %xmm15, %xmm8
  99. maxsd %xmm7, %xmm1
  100. movsd 11 * SIZE(X), %xmm7
  101. andps %xmm15, %xmm9
  102. addsd %xmm8, %xmm9
  103. movsd 12 * SIZE(X), %xmm8
  104. andps %xmm15, %xmm10
  105. andps %xmm15, %xmm11
  106. addsd %xmm10, %xmm11
  107. movsd 14 * SIZE(X), %xmm10
  108. maxsd %xmm9, %xmm0
  109. movsd 13 * SIZE(X), %xmm9
  110. andps %xmm15, %xmm4
  111. maxsd %xmm11, %xmm1
  112. movsd 15 * SIZE(X), %xmm11
  113. andps %xmm15, %xmm5
  114. addsd %xmm4, %xmm5
  115. addq $8 * SIZE, X
  116. decq I
  117. jg .L12
  118. ALIGN_4
  119. .L13:
  120. andps %xmm15, %xmm6
  121. andps %xmm15, %xmm7
  122. addsd %xmm6, %xmm7
  123. maxsd %xmm5, %xmm0
  124. andps %xmm15, %xmm8
  125. maxsd %xmm7, %xmm1
  126. andps %xmm15, %xmm9
  127. addsd %xmm8, %xmm9
  128. andps %xmm15, %xmm10
  129. andps %xmm15, %xmm11
  130. addsd %xmm10, %xmm11
  131. maxsd %xmm9, %xmm0
  132. maxsd %xmm11, %xmm1
  133. addq $8 * SIZE, X
  134. ALIGN_4
  135. .L15:
  136. testq $2, M
  137. jle .L17
  138. movsd 0 * SIZE(X), %xmm4
  139. movsd 1 * SIZE(X), %xmm5
  140. movsd 2 * SIZE(X), %xmm6
  141. movsd 3 * SIZE(X), %xmm7
  142. addq $4 * SIZE, X
  143. andps %xmm15, %xmm4
  144. andps %xmm15, %xmm5
  145. addsd %xmm4, %xmm5
  146. andps %xmm15, %xmm6
  147. andps %xmm15, %xmm7
  148. addsd %xmm6, %xmm7
  149. maxsd %xmm5, %xmm0
  150. maxsd %xmm7, %xmm1
  151. ALIGN_3
  152. .L17:
  153. testq $1, M
  154. jle .L998
  155. movsd 0 * SIZE(X), %xmm4
  156. movsd 1 * SIZE(X), %xmm5
  157. andps %xmm15, %xmm4
  158. andps %xmm15, %xmm5
  159. addsd %xmm4, %xmm5
  160. maxsd %xmm5, %xmm0
  161. jmp .L998
  162. ALIGN_3
  163. .L20:
  164. movq M, I
  165. sarq $2, I
  166. jle .L25
  167. movsd 0 * SIZE(X), %xmm4
  168. movsd 1 * SIZE(X), %xmm5
  169. addq INCX, X
  170. movsd 0 * SIZE(X), %xmm6
  171. movsd 1 * SIZE(X), %xmm7
  172. addq INCX, X
  173. movsd 0 * SIZE(X), %xmm8
  174. andps %xmm15, %xmm4
  175. movsd 1 * SIZE(X), %xmm9
  176. addq INCX, X
  177. andps %xmm15, %xmm5
  178. movsd 0 * SIZE(X), %xmm10
  179. addsd %xmm4, %xmm5
  180. movsd 1 * SIZE(X), %xmm11
  181. addq INCX, X
  182. decq I
  183. jle .L23
  184. ALIGN_4
  185. .L22:
  186. #ifdef PREFETCH
  187. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  188. #endif
  189. andps %xmm15, %xmm6
  190. movsd 0 * SIZE(X), %xmm4
  191. andps %xmm15, %xmm7
  192. addsd %xmm6, %xmm7
  193. maxsd %xmm5, %xmm0
  194. movsd 1 * SIZE(X), %xmm5
  195. andps %xmm15, %xmm8
  196. addq INCX, X
  197. maxsd %xmm7, %xmm1
  198. movsd 0 * SIZE(X), %xmm6
  199. andps %xmm15, %xmm9
  200. movsd 1 * SIZE(X), %xmm7
  201. addsd %xmm8, %xmm9
  202. addq INCX, X
  203. andps %xmm15, %xmm10
  204. movsd 0 * SIZE(X), %xmm8
  205. andps %xmm15, %xmm11
  206. addsd %xmm10, %xmm11
  207. maxsd %xmm9, %xmm0
  208. movsd 1 * SIZE(X), %xmm9
  209. addq INCX, X
  210. andps %xmm15, %xmm4
  211. movsd 0 * SIZE(X), %xmm10
  212. maxsd %xmm11, %xmm1
  213. movsd 1 * SIZE(X), %xmm11
  214. andps %xmm15, %xmm5
  215. addq INCX, X
  216. addsd %xmm4, %xmm5
  217. decq I
  218. jg .L22
  219. ALIGN_4
  220. .L23:
  221. andps %xmm15, %xmm6
  222. andps %xmm15, %xmm7
  223. addsd %xmm6, %xmm7
  224. maxsd %xmm5, %xmm0
  225. andps %xmm15, %xmm8
  226. maxsd %xmm7, %xmm1
  227. andps %xmm15, %xmm9
  228. addsd %xmm8, %xmm9
  229. andps %xmm15, %xmm10
  230. andps %xmm15, %xmm11
  231. addsd %xmm10, %xmm11
  232. maxsd %xmm9, %xmm0
  233. maxsd %xmm11, %xmm1
  234. ALIGN_4
  235. .L25:
  236. testq $2, M
  237. jle .L27
  238. movsd 0 * SIZE(X), %xmm4
  239. movsd 1 * SIZE(X), %xmm5
  240. addq INCX, X
  241. movsd 0 * SIZE(X), %xmm6
  242. movsd 1 * SIZE(X), %xmm7
  243. addq INCX, X
  244. andps %xmm15, %xmm4
  245. andps %xmm15, %xmm5
  246. addsd %xmm4, %xmm5
  247. andps %xmm15, %xmm6
  248. andps %xmm15, %xmm7
  249. addsd %xmm6, %xmm7
  250. maxsd %xmm5, %xmm0
  251. maxsd %xmm7, %xmm1
  252. ALIGN_3
  253. .L27:
  254. testq $1, M
  255. jle .L998
  256. movsd 0 * SIZE(X), %xmm4
  257. movsd 1 * SIZE(X), %xmm5
  258. andps %xmm15, %xmm4
  259. andps %xmm15, %xmm5
  260. addsd %xmm4, %xmm5
  261. maxsd %xmm5, %xmm0
  262. ALIGN_3
  263. .L998:
  264. maxsd %xmm1, %xmm0
  265. ALIGN_4
  266. .L999:
  267. RESTOREREGISTERS
  268. ret
  269. EPILOGUE