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.

rot.S 6.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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
  41. #define X ARG2
  42. #define INCX ARG3
  43. #define Y ARG4
  44. #ifndef WINDOWS_ABI
  45. #define INCY ARG5 /* r8 */
  46. #else
  47. #define INCY %r10
  48. #endif
  49. #define I %rax
  50. #include "l1param.h"
  51. PROLOGUE
  52. PROFCODE
  53. #ifdef WINDOWS_ABI
  54. movq 48(%rsp), INCY
  55. FLD 72(%rsp)
  56. FLD 56(%rsp)
  57. #else
  58. FLD 24(%rsp)
  59. FLD 8(%rsp)
  60. #endif
  61. salq $BASE_SHIFT, INCX
  62. salq $BASE_SHIFT, INCY
  63. testq N, N
  64. jle .L999
  65. cmpq $SIZE, INCX
  66. jne .L50
  67. cmpq $SIZE, INCY
  68. jne .L50
  69. movq N, I
  70. sarq $2, I
  71. jle .L15
  72. ALIGN_4
  73. .L10:
  74. #ifdef PREFETCHW
  75. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  76. #endif
  77. FLD 0 * SIZE(X)
  78. FLD 0 * SIZE(Y)
  79. fld %st(1)
  80. fmul %st(3), %st
  81. fld %st(1)
  82. fmul %st(5), %st
  83. faddp %st, %st(1)
  84. FST 0 * SIZE(X)
  85. fmul %st(2), %st
  86. fxch %st(1)
  87. fmul %st(3), %st
  88. fsubrp %st, %st(1)
  89. FST 0 * SIZE(Y)
  90. FLD 1 * SIZE(X)
  91. FLD 1 * SIZE(Y)
  92. fld %st(1)
  93. fmul %st(3), %st
  94. fld %st(1)
  95. fmul %st(5), %st
  96. faddp %st, %st(1)
  97. FST 1 * SIZE(X)
  98. fmul %st(2), %st
  99. fxch %st(1)
  100. fmul %st(3), %st
  101. fsubrp %st, %st(1)
  102. FST 1 * SIZE(Y)
  103. #ifdef PREFETCHW
  104. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(Y)
  105. #endif
  106. FLD 2 * SIZE(X)
  107. FLD 2 * SIZE(Y)
  108. fld %st(1)
  109. fmul %st(3), %st
  110. fld %st(1)
  111. fmul %st(5), %st
  112. faddp %st, %st(1)
  113. FST 2 * SIZE(X)
  114. fmul %st(2), %st
  115. fxch %st(1)
  116. fmul %st(3), %st
  117. fsubrp %st, %st(1)
  118. FST 2 * SIZE(Y)
  119. FLD 3 * SIZE(X)
  120. FLD 3 * SIZE(Y)
  121. fld %st(1)
  122. fmul %st(3), %st
  123. fld %st(1)
  124. fmul %st(5), %st
  125. faddp %st, %st(1)
  126. FST 3 * SIZE(X)
  127. fmul %st(2), %st
  128. fxch %st(1)
  129. fmul %st(3), %st
  130. fsubrp %st, %st(1)
  131. FST 3 * SIZE(Y)
  132. addq $4 * SIZE, X
  133. addq $4 * SIZE, Y
  134. decq I
  135. jg .L10
  136. ALIGN_4
  137. .L15:
  138. movq N, I
  139. andq $3, I
  140. jle .L999
  141. ALIGN_4
  142. .L16:
  143. FLD 0 * SIZE(X)
  144. FLD 0 * SIZE(Y)
  145. fld %st(1)
  146. fmul %st(3), %st
  147. fld %st(1)
  148. fmul %st(5), %st
  149. faddp %st, %st(1)
  150. FST 0 * SIZE(X)
  151. fmul %st(2), %st
  152. fxch %st(1)
  153. fmul %st(3), %st
  154. fsubrp %st, %st(1)
  155. FST 0 * SIZE(Y)
  156. addq $SIZE, X
  157. addq $SIZE, Y
  158. decq I
  159. jg .L16
  160. jmp .L999
  161. ALIGN_4
  162. .L50:
  163. movq N, I
  164. sarq $2, I
  165. jle .L55
  166. ALIGN_4
  167. .L51:
  168. FLD 0 * SIZE(X)
  169. FLD 0 * SIZE(Y)
  170. fld %st(1)
  171. fmul %st(3), %st
  172. fld %st(1)
  173. fmul %st(5), %st
  174. faddp %st, %st(1)
  175. FST 0 * SIZE(X)
  176. fmul %st(2), %st
  177. fxch %st(1)
  178. fmul %st(3), %st
  179. fsubrp %st, %st(1)
  180. FST 0 * SIZE(Y)
  181. addq INCX, X
  182. addq INCY, Y
  183. FLD 0 * SIZE(X)
  184. FLD 0 * SIZE(Y)
  185. fld %st(1)
  186. fmul %st(3), %st
  187. fld %st(1)
  188. fmul %st(5), %st
  189. faddp %st, %st(1)
  190. FST 0 * SIZE(X)
  191. fmul %st(2), %st
  192. fxch %st(1)
  193. fmul %st(3), %st
  194. fsubrp %st, %st(1)
  195. FST 0 * SIZE(Y)
  196. addq INCX, X
  197. addq INCY, Y
  198. FLD 0 * SIZE(X)
  199. FLD 0 * SIZE(Y)
  200. fld %st(1)
  201. fmul %st(3), %st
  202. fld %st(1)
  203. fmul %st(5), %st
  204. faddp %st, %st(1)
  205. FST 0 * SIZE(X)
  206. fmul %st(2), %st
  207. fxch %st(1)
  208. fmul %st(3), %st
  209. fsubrp %st, %st(1)
  210. FST 0 * SIZE(Y)
  211. addq INCX, X
  212. addq INCY, Y
  213. FLD 0 * SIZE(X)
  214. FLD 0 * SIZE(Y)
  215. fld %st(1)
  216. fmul %st(3), %st
  217. fld %st(1)
  218. fmul %st(5), %st
  219. faddp %st, %st(1)
  220. FST 0 * SIZE(X)
  221. fmul %st(2), %st
  222. fxch %st(1)
  223. fmul %st(3), %st
  224. fsubrp %st, %st(1)
  225. FST 0 * SIZE(Y)
  226. addq INCX, X
  227. addq INCY, Y
  228. decq I
  229. jg .L51
  230. ALIGN_4
  231. .L55:
  232. movq N, I
  233. andq $3, I
  234. jle .L999
  235. ALIGN_4
  236. .L56:
  237. FLD 0 * SIZE(X)
  238. FLD 0 * SIZE(Y)
  239. fld %st(1)
  240. fmul %st(3), %st
  241. fld %st(1)
  242. fmul %st(5), %st
  243. faddp %st, %st(1)
  244. FST 0 * SIZE(X)
  245. fmul %st(2), %st
  246. fxch %st(1)
  247. fmul %st(3), %st
  248. fsubrp %st, %st(1)
  249. FST 0 * SIZE(Y)
  250. addq INCX, X
  251. addq INCY, Y
  252. decq I
  253. jg .L56
  254. ALIGN_4
  255. .L999:
  256. ffreep %st
  257. ffreep %st
  258. ret
  259. EPILOGUE