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.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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 %i0
  41. #define X %i1
  42. #define INCX %i2
  43. #define Y %i3
  44. #define INCY %i4
  45. #define I %i5
  46. #ifdef DOUBLE
  47. #define a1 %f0
  48. #define a2 %f2
  49. #define a3 %f4
  50. #define a4 %f6
  51. #define a5 %f8
  52. #define a6 %f10
  53. #define a7 %f12
  54. #define a8 %f14
  55. #else
  56. #define a1 %f0
  57. #define a2 %f1
  58. #define a3 %f2
  59. #define a4 %f3
  60. #define a5 %f4
  61. #define a6 %f5
  62. #define a7 %f6
  63. #define a8 %f7
  64. #endif
  65. PROLOGUE
  66. SAVESP
  67. sll INCX, ZBASE_SHIFT, INCX
  68. sll INCY, ZBASE_SHIFT, INCY
  69. cmp INCX, 2 * SIZE
  70. bne .LL50
  71. nop
  72. cmp INCY, 2 * SIZE
  73. bne .LL50
  74. nop
  75. sra N, 2, I
  76. cmp I, 0
  77. ble,pn %icc, .LL15
  78. nop
  79. #define PREFETCHSIZE 32
  80. .LL11:
  81. prefetch [X + PREFETCHSIZE * SIZE], 0
  82. prefetch [Y + PREFETCHSIZE * SIZE], 0
  83. LDF [X + 0 * SIZE], a1
  84. LDF [X + 1 * SIZE], a2
  85. LDF [X + 2 * SIZE], a3
  86. LDF [X + 3 * SIZE], a4
  87. LDF [X + 4 * SIZE], a5
  88. LDF [X + 5 * SIZE], a6
  89. LDF [X + 6 * SIZE], a7
  90. LDF [X + 7 * SIZE], a8
  91. STF a1, [Y + 0 * SIZE]
  92. add I, -1, I
  93. STF a2, [Y + 1 * SIZE]
  94. cmp I, 0
  95. STF a3, [Y + 2 * SIZE]
  96. add X, 8 * SIZE, X
  97. STF a4, [Y + 3 * SIZE]
  98. STF a5, [Y + 4 * SIZE]
  99. STF a6, [Y + 5 * SIZE]
  100. STF a7, [Y + 6 * SIZE]
  101. STF a8, [Y + 7 * SIZE]
  102. bg,pt %icc, .LL11
  103. add Y, 8 * SIZE, Y
  104. .LL15:
  105. and N, 3, I
  106. cmp I, 0
  107. ble,a,pn %icc, .LL19
  108. nop
  109. .LL16:
  110. LDF [X + 0 * SIZE], a1
  111. LDF [X + 1 * SIZE], a2
  112. add I, -1, I
  113. cmp I, 0
  114. STF a1, [Y + 0 * SIZE]
  115. add X, 2 * SIZE, X
  116. STF a2, [Y + 1 * SIZE]
  117. bg,pt %icc, .LL16
  118. add Y, 2 * SIZE, Y
  119. .LL19:
  120. return %i7 + 8
  121. clr %g0
  122. .LL50:
  123. sra N, 2, I
  124. cmp I, 0
  125. ble,pn %icc, .LL55
  126. nop
  127. .LL51:
  128. LDF [X + 0 * SIZE], a1
  129. LDF [X + 1 * SIZE], a2
  130. add X, INCX, X
  131. LDF [X + 0 * SIZE], a3
  132. LDF [X + 1 * SIZE], a4
  133. add X, INCX, X
  134. LDF [X + 0 * SIZE], a5
  135. LDF [X + 1 * SIZE], a6
  136. add X, INCX, X
  137. LDF [X + 0 * SIZE], a7
  138. LDF [X + 1 * SIZE], a8
  139. add X, INCX, X
  140. STF a1, [Y + 0 * SIZE]
  141. add I, -1, I
  142. STF a2, [Y + 1 * SIZE]
  143. add Y, INCY, Y
  144. cmp I, 0
  145. STF a3, [Y + 0 * SIZE]
  146. STF a4, [Y + 1 * SIZE]
  147. add Y, INCY, Y
  148. STF a5, [Y + 0 * SIZE]
  149. STF a6, [Y + 1 * SIZE]
  150. add Y, INCY, Y
  151. STF a7, [Y + 0 * SIZE]
  152. STF a8, [Y + 1 * SIZE]
  153. bg,pt %icc, .LL51
  154. add Y, INCY, Y
  155. .LL55:
  156. and N, 3, I
  157. cmp I, 0
  158. ble,a,pn %icc, .LL59
  159. nop
  160. .LL56:
  161. LDF [X + 0 * SIZE], a1
  162. LDF [X + 1 * SIZE], a2
  163. add I, -1, I
  164. cmp I, 0
  165. add X, INCX, X
  166. STF a1, [Y + 0 * SIZE]
  167. STF a2, [Y + 1 * SIZE]
  168. bg,pt %icc, .LL56
  169. add Y, INCY, Y
  170. .LL59:
  171. return %i7 + 8
  172. clr %o0
  173. EPILOGUE