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.S 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. testq N, N
  56. jle .L88
  57. salq $ZBASE_SHIFT, INCX
  58. salq $ZBASE_SHIFT, INCY
  59. fldz
  60. fldz
  61. fldz
  62. fldz
  63. cmpq $2 * SIZE, INCX
  64. jne .L14
  65. cmpq $2 * SIZE, INCY
  66. jne .L14
  67. movq N, %rax
  68. sarq $1, %rax
  69. jle .L15
  70. ALIGN_3
  71. .L16:
  72. #ifdef PREFETCH
  73. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  74. #endif
  75. FLD 0 * SIZE(X)
  76. FLD 0 * SIZE(Y)
  77. fmul %st(1)
  78. faddp %st, %st(2)
  79. FLD 1 * SIZE(Y)
  80. fmulp %st, %st(1)
  81. faddp %st, %st(2)
  82. FLD 1 * SIZE(X)
  83. FLD 0 * SIZE(Y)
  84. fmul %st(1)
  85. faddp %st, %st(4)
  86. FLD 1 * SIZE(Y)
  87. fmulp %st, %st(1)
  88. faddp %st, %st(4)
  89. FLD 2 * SIZE(X)
  90. FLD 2 * SIZE(Y)
  91. fmul %st(1)
  92. faddp %st, %st(2)
  93. #ifdef PREFETCH
  94. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(Y)
  95. #endif
  96. FLD 3 * SIZE(Y)
  97. fmulp %st, %st(1)
  98. faddp %st, %st(2)
  99. FLD 3 * SIZE(X)
  100. FLD 2 * SIZE(Y)
  101. fmul %st(1)
  102. faddp %st, %st(4)
  103. FLD 3 * SIZE(Y)
  104. fmulp %st, %st(1)
  105. faddp %st, %st(4)
  106. addq $4 * SIZE, X
  107. addq $4 * SIZE, Y
  108. decq %rax
  109. jg .L16
  110. ALIGN_3
  111. .L15:
  112. movq N, %rax
  113. andq $1, %rax
  114. jle .L27
  115. ALIGN_3
  116. .L22:
  117. FLD 0 * SIZE(X)
  118. FLD 0 * SIZE(Y)
  119. fmul %st(1)
  120. faddp %st, %st(2)
  121. FLD 1 * SIZE(Y)
  122. fmulp %st, %st(1)
  123. faddp %st, %st(2)
  124. FLD 1 * SIZE(X)
  125. FLD 0 * SIZE(Y)
  126. fmul %st(1)
  127. faddp %st, %st(4)
  128. FLD 1 * SIZE(Y)
  129. fmulp %st, %st(1)
  130. faddp %st, %st(4)
  131. jmp .L27
  132. ALIGN_3
  133. .L14:
  134. movq N, %rax
  135. sarq $1, %rax
  136. jle .L30
  137. ALIGN_3
  138. .L31:
  139. FLD 0 * SIZE(X)
  140. FLD 0 * SIZE(Y)
  141. fmul %st(1)
  142. faddp %st, %st(2)
  143. FLD 1 * SIZE(Y)
  144. fmulp %st, %st(1)
  145. faddp %st, %st(2)
  146. FLD 1 * SIZE(X)
  147. FLD 0 * SIZE(Y)
  148. fmul %st(1)
  149. faddp %st, %st(4)
  150. FLD 1 * SIZE(Y)
  151. fmulp %st, %st(1)
  152. faddp %st, %st(4)
  153. addq INCX, X
  154. FLD 0 * SIZE(X)
  155. addq INCY, Y
  156. FLD 0 * SIZE(Y)
  157. fmul %st(1)
  158. faddp %st, %st(2)
  159. FLD 1 * SIZE(Y)
  160. fmulp %st, %st(1)
  161. faddp %st, %st(2)
  162. FLD 1 * SIZE(X)
  163. FLD 0 * SIZE(Y)
  164. fmul %st(1)
  165. faddp %st, %st(4)
  166. FLD 1 * SIZE(Y)
  167. fmulp %st, %st(1)
  168. faddp %st, %st(4)
  169. addq INCX, X
  170. addq INCY, Y
  171. decq %rax
  172. jg .L31
  173. ALIGN_3
  174. .L30:
  175. movq N, %rax
  176. andq $1, %rax
  177. jle .L27
  178. ALIGN_3
  179. .L37:
  180. FLD 0 * SIZE(X)
  181. FLD 0 * SIZE(Y)
  182. fmul %st(1)
  183. faddp %st, %st(2)
  184. FLD 1 * SIZE(Y)
  185. fmulp %st, %st(1)
  186. faddp %st, %st(2)
  187. FLD 1 * SIZE(X)
  188. FLD 0 * SIZE(Y)
  189. fmul %st(1)
  190. faddp %st, %st(4)
  191. FLD 1 * SIZE(Y)
  192. fmulp %st, %st(1)
  193. faddp %st, %st(4)
  194. ALIGN_3
  195. .L27:
  196. #ifndef CONJ
  197. fsubp %st, %st(3)
  198. faddp %st, %st(1)
  199. fxch %st(1)
  200. #else
  201. faddp %st, %st(3)
  202. fsubp %st, %st(1)
  203. fxch %st(1)
  204. #endif
  205. ret
  206. ALIGN_3
  207. .L88:
  208. fldz
  209. fldz
  210. ret
  211. EPILOGUE