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

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