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.

zrot.S 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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 $ZBASE_SHIFT, INCX
  62. salq $ZBASE_SHIFT, INCY
  63. testq N, N
  64. jle .L999
  65. cmpq $2 * SIZE, INCX
  66. jne .L50
  67. cmpq $2 * SIZE, INCY
  68. jne .L50
  69. movq N, I
  70. sarq $1, I
  71. jle .L15
  72. ALIGN_4
  73. .L10:
  74. #if defined(PREFETCHW)
  75. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(Y)
  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. #if defined(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 $1, 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. FLD 1 * SIZE(X)
  157. FLD 1 * SIZE(Y)
  158. fld %st(1)
  159. fmul %st(3), %st
  160. fld %st(1)
  161. fmul %st(5), %st
  162. faddp %st, %st(1)
  163. FST 1 * SIZE(X)
  164. fmul %st(2), %st
  165. fxch %st(1)
  166. fmul %st(3), %st
  167. fsubrp %st, %st(1)
  168. FST 1 * SIZE(Y)
  169. jmp .L999
  170. ALIGN_4
  171. .L50:
  172. movq N, I
  173. sarq $1, I
  174. jle .L55
  175. ALIGN_4
  176. .L51:
  177. FLD 0 * SIZE(X)
  178. FLD 0 * SIZE(Y)
  179. fld %st(1)
  180. fmul %st(3), %st
  181. fld %st(1)
  182. fmul %st(5), %st
  183. faddp %st, %st(1)
  184. FST 0 * SIZE(X)
  185. fmul %st(2), %st
  186. fxch %st(1)
  187. fmul %st(3), %st
  188. fsubrp %st, %st(1)
  189. FST 0 * SIZE(Y)
  190. FLD 1 * SIZE(X)
  191. FLD 1 * SIZE(Y)
  192. fld %st(1)
  193. fmul %st(3), %st
  194. fld %st(1)
  195. fmul %st(5), %st
  196. faddp %st, %st(1)
  197. FST 1 * SIZE(X)
  198. fmul %st(2), %st
  199. fxch %st(1)
  200. fmul %st(3), %st
  201. fsubrp %st, %st(1)
  202. FST 1 * SIZE(Y)
  203. addq INCX, X
  204. addq INCY, Y
  205. FLD 0 * SIZE(X)
  206. FLD 0 * SIZE(Y)
  207. fld %st(1)
  208. fmul %st(3), %st
  209. fld %st(1)
  210. fmul %st(5), %st
  211. faddp %st, %st(1)
  212. FST 0 * SIZE(X)
  213. fmul %st(2), %st
  214. fxch %st(1)
  215. fmul %st(3), %st
  216. fsubrp %st, %st(1)
  217. FST 0 * SIZE(Y)
  218. FLD 1 * SIZE(X)
  219. FLD 1 * SIZE(Y)
  220. fld %st(1)
  221. fmul %st(3), %st
  222. fld %st(1)
  223. fmul %st(5), %st
  224. faddp %st, %st(1)
  225. FST 1 * SIZE(X)
  226. fmul %st(2), %st
  227. fxch %st(1)
  228. fmul %st(3), %st
  229. fsubrp %st, %st(1)
  230. FST 1 * SIZE(Y)
  231. addq INCX, X
  232. addq INCY, Y
  233. decq I
  234. jg .L51
  235. ALIGN_4
  236. .L55:
  237. movq N, I
  238. andq $1, I
  239. jle .L999
  240. ALIGN_4
  241. .L56:
  242. FLD 0 * SIZE(X)
  243. FLD 0 * SIZE(Y)
  244. fld %st(1)
  245. fmul %st(3), %st
  246. fld %st(1)
  247. fmul %st(5), %st
  248. faddp %st, %st(1)
  249. FST 0 * SIZE(X)
  250. fmul %st(2), %st
  251. fxch %st(1)
  252. fmul %st(3), %st
  253. fsubrp %st, %st(1)
  254. FST 0 * SIZE(Y)
  255. FLD 1 * SIZE(X)
  256. FLD 1 * SIZE(Y)
  257. fld %st(1)
  258. fmul %st(3), %st
  259. fld %st(1)
  260. fmul %st(5), %st
  261. faddp %st, %st(1)
  262. FST 1 * SIZE(X)
  263. fmul %st(2), %st
  264. fxch %st(1)
  265. fmul %st(3), %st
  266. fsubrp %st, %st(1)
  267. FST 1 * SIZE(Y)
  268. ALIGN_4
  269. .L999:
  270. ffreep %st
  271. ffreep %st
  272. ret
  273. EPILOGUE