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.

zcopy.S 5.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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 STACK 12
  41. #define ARGS 0
  42. #define M 4 + STACK + ARGS(%esp)
  43. #define X 8 + STACK + ARGS(%esp)
  44. #define INCX 12 + STACK + ARGS(%esp)
  45. #define Y 16 + STACK + ARGS(%esp)
  46. #define INCY 20 + STACK + ARGS(%esp)
  47. PROLOGUE
  48. pushl %edi
  49. pushl %esi
  50. pushl %ebx
  51. PROFCODE
  52. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  53. EMMS
  54. #endif
  55. movl M, %ebx
  56. movl X, %ecx
  57. movl INCX, %esi
  58. movl Y, %edx
  59. movl INCY, %edi
  60. testl %ebx, %ebx # if m == 0 goto End
  61. jle .L999
  62. sall $ZBASE_SHIFT, %esi
  63. sall $ZBASE_SHIFT, %edi
  64. cmpl $2 * SIZE, %esi # if incx != 1
  65. jne .L100
  66. cmpl $2 * SIZE, %edi # if incy != 1
  67. jne .L100
  68. movl %ebx, %eax # i = m
  69. sarl $2, %eax
  70. jle .L20
  71. ALIGN_2
  72. .L11:
  73. #if defined(DOUBLE) || defined(XDOUBLE)
  74. FLD 7 * SIZE(%ecx)
  75. FLD 6 * SIZE(%ecx)
  76. FLD 5 * SIZE(%ecx)
  77. FLD 4 * SIZE(%ecx)
  78. FLD 3 * SIZE(%ecx)
  79. FLD 2 * SIZE(%ecx)
  80. FLD 1 * SIZE(%ecx)
  81. FLD 0 * SIZE(%ecx)
  82. FST 0 * SIZE(%edx)
  83. FST 1 * SIZE(%edx)
  84. FST 2 * SIZE(%edx)
  85. FST 3 * SIZE(%edx)
  86. FST 4 * SIZE(%edx)
  87. FST 5 * SIZE(%edx)
  88. FST 6 * SIZE(%edx)
  89. FST 7 * SIZE(%edx)
  90. #else
  91. fldl 6 * SIZE(%ecx)
  92. fldl 4 * SIZE(%ecx)
  93. fldl 2 * SIZE(%ecx)
  94. fldl 0 * SIZE(%ecx)
  95. fstpl 0 * SIZE(%edx)
  96. fstpl 2 * SIZE(%edx)
  97. fstpl 4 * SIZE(%edx)
  98. fstpl 6 * SIZE(%edx)
  99. #endif
  100. addl $8 * SIZE, %ecx
  101. addl $8 * SIZE, %edx
  102. decl %eax
  103. jg .L11
  104. ALIGN_2
  105. .L20:
  106. movl %ebx, %eax # i = m
  107. andl $3, %eax
  108. jle .L99
  109. ALIGN_2
  110. .L21:
  111. #if defined(DOUBLE) || defined(XDOUBLE)
  112. FLD 1 * SIZE(%ecx)
  113. FLD 0 * SIZE(%ecx)
  114. FST 0 * SIZE(%edx)
  115. FST 1 * SIZE(%edx)
  116. #else
  117. fldl 0 * SIZE(%ecx)
  118. fstpl 0 * SIZE(%edx)
  119. #endif
  120. addl $2 * SIZE, %ecx
  121. addl $2 * SIZE, %edx
  122. decl %eax
  123. jg .L21
  124. .L99:
  125. xorl %eax,%eax
  126. popl %ebx
  127. popl %esi
  128. popl %edi
  129. ret
  130. ALIGN_3
  131. .L100:
  132. movl %ebx, %eax
  133. sarl $2, %eax
  134. jle .L120
  135. ALIGN_2
  136. .L111:
  137. #if defined(DOUBLE) || defined(XDOUBLE)
  138. FLD 0 * SIZE(%ecx)
  139. FLD 1 * SIZE(%ecx)
  140. addl %esi, %ecx
  141. FLD 0 * SIZE(%ecx)
  142. FLD 1 * SIZE(%ecx)
  143. addl %esi, %ecx
  144. FLD 0 * SIZE(%ecx)
  145. FLD 1 * SIZE(%ecx)
  146. addl %esi, %ecx
  147. FLD 0 * SIZE(%ecx)
  148. FLD 1 * SIZE(%ecx)
  149. addl %esi, %ecx
  150. fxch %st(7)
  151. FST 0 * SIZE(%edx)
  152. fxch %st(5)
  153. FST 1 * SIZE(%edx)
  154. addl %edi, %edx
  155. fxch %st(3)
  156. FST 0 * SIZE(%edx)
  157. fxch %st(1)
  158. FST 1 * SIZE(%edx)
  159. addl %edi, %edx
  160. FST 0 * SIZE(%edx)
  161. FST 1 * SIZE(%edx)
  162. addl %edi, %edx
  163. FST 0 * SIZE(%edx)
  164. FST 1 * SIZE(%edx)
  165. addl %edi, %edx
  166. #else
  167. fldl 0 * SIZE(%ecx)
  168. addl %esi, %ecx
  169. fldl 0 * SIZE(%ecx)
  170. addl %esi, %ecx
  171. fldl 0 * SIZE(%ecx)
  172. addl %esi, %ecx
  173. fldl 0 * SIZE(%ecx)
  174. addl %esi, %ecx
  175. fxch %st(3)
  176. fstpl 0 * SIZE(%edx)
  177. addl %edi, %edx
  178. fxch %st(1)
  179. fstpl 0 * SIZE(%edx)
  180. addl %edi, %edx
  181. fstpl 0 * SIZE(%edx)
  182. addl %edi, %edx
  183. fstpl 0 * SIZE(%edx)
  184. addl %edi, %edx
  185. #endif
  186. decl %eax
  187. jg .L111
  188. .L120:
  189. movl %ebx, %eax
  190. andl $3, %eax
  191. jle .L999
  192. ALIGN_2
  193. .L121:
  194. FLD 0 * SIZE(%ecx)
  195. FLD 1 * SIZE(%ecx)
  196. addl %esi, %ecx
  197. fxch %st(1)
  198. FST 0 * SIZE(%edx)
  199. FST 1 * SIZE(%edx)
  200. addl %edi, %edx
  201. decl %eax
  202. jg .L121
  203. .L999:
  204. xorl %eax,%eax
  205. popl %ebx
  206. popl %esi
  207. popl %edi
  208. ret
  209. EPILOGUE