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.

zswap.S 6.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. PROLOGUE
  41. PROFCODE
  42. .frame $sp, 0, $26, 0
  43. mov $21, $17
  44. ldl $18, 0($sp)
  45. ldq $19, 8($sp)
  46. ldl $20, 16($sp)
  47. #ifndef PROFILE
  48. .prologue 0
  49. #else
  50. .prologue 1
  51. #endif
  52. ble $16, $SubEnd # if n <= 0 goto $End
  53. cmpeq $18, 1, $1
  54. addq $18, $18, $18
  55. cmpeq $20, 1, $2
  56. addq $20, $20, $20
  57. sra $16, 2, $21
  58. and $1, $2, $1
  59. and $16, 3, $22
  60. beq $1, $Sub
  61. ble $21, $MainRemain
  62. .align 4
  63. $MainLoop:
  64. LD $f10, 0*SIZE($19)
  65. LD $f11, 1*SIZE($19)
  66. LD $f12, 2*SIZE($19)
  67. LD $f13, 3*SIZE($19)
  68. LD $f14, 4*SIZE($19)
  69. LD $f15, 5*SIZE($19)
  70. LD $f16, 6*SIZE($19)
  71. LD $f17, 7*SIZE($19)
  72. LD $f20, 0*SIZE($17)
  73. LD $f21, 1*SIZE($17)
  74. LD $f22, 2*SIZE($17)
  75. LD $f23, 3*SIZE($17)
  76. LD $f24, 4*SIZE($17)
  77. LD $f25, 5*SIZE($17)
  78. LD $f26, 6*SIZE($17)
  79. LD $f27, 7*SIZE($17)
  80. lds $f31, 16*SIZE($17)
  81. unop
  82. lds $f31, 16*SIZE($19)
  83. subl $21, 1, $21
  84. ST $f10, 0*SIZE($17)
  85. ST $f11, 1*SIZE($17)
  86. ST $f12, 2*SIZE($17)
  87. ST $f13, 3*SIZE($17)
  88. ST $f14, 4*SIZE($17)
  89. ST $f15, 5*SIZE($17)
  90. ST $f16, 6*SIZE($17)
  91. ST $f17, 7*SIZE($17)
  92. ST $f20, 0*SIZE($19)
  93. ST $f21, 1*SIZE($19)
  94. ST $f22, 2*SIZE($19)
  95. ST $f23, 3*SIZE($19)
  96. ST $f24, 4*SIZE($19)
  97. ST $f25, 5*SIZE($19)
  98. ST $f26, 6*SIZE($19)
  99. ST $f27, 7*SIZE($19)
  100. lda $17, 8*SIZE($17)
  101. lda $19, 8*SIZE($19)
  102. bgt $21, $MainLoop
  103. .align 4
  104. $MainRemain:
  105. ble $22, $MainEnd
  106. .align 4
  107. $MainRemainLoop:
  108. LD $f10, 0*SIZE($19)
  109. LD $f11, 1*SIZE($19)
  110. LD $f20, 0*SIZE($17)
  111. LD $f21, 1*SIZE($17)
  112. lda $17, 2*SIZE($17)
  113. lda $19, 2*SIZE($19)
  114. subl $22, 1, $22
  115. ST $f10, -2*SIZE($17)
  116. ST $f11, -1*SIZE($17)
  117. ST $f20, -2*SIZE($19)
  118. ST $f21, -1*SIZE($19)
  119. bgt $22, $MainRemainLoop
  120. .align 4
  121. $MainEnd:
  122. clr $0
  123. ret
  124. .align 4
  125. $Sub:
  126. mov $17, $23
  127. mov $19, $24
  128. ble $21, $SubRemain
  129. .align 4
  130. $SubLoop:
  131. LD $f10, 0*SIZE($19)
  132. LD $f11, 1*SIZE($19)
  133. SXADDQ $20, $19, $19
  134. LD $f12, 0*SIZE($19)
  135. LD $f13, 1*SIZE($19)
  136. SXADDQ $20, $19, $19
  137. LD $f14, 0*SIZE($19)
  138. LD $f15, 1*SIZE($19)
  139. SXADDQ $20, $19, $19
  140. LD $f16, 0*SIZE($19)
  141. LD $f17, 1*SIZE($19)
  142. SXADDQ $20, $19, $19
  143. LD $f20, 0*SIZE($17)
  144. LD $f21, 1*SIZE($17)
  145. SXADDQ $18, $17, $17
  146. LD $f22, 0*SIZE($17)
  147. LD $f23, 1*SIZE($17)
  148. SXADDQ $18, $17, $17
  149. LD $f24, 0*SIZE($17)
  150. LD $f25, 1*SIZE($17)
  151. SXADDQ $18, $17, $17
  152. LD $f26, 0*SIZE($17)
  153. LD $f27, 1*SIZE($17)
  154. SXADDQ $18, $17, $17
  155. ST $f10, 0*SIZE($23)
  156. ST $f11, 1*SIZE($23)
  157. SXADDQ $18, $23, $23
  158. ST $f12, 0*SIZE($23)
  159. ST $f13, 1*SIZE($23)
  160. SXADDQ $18, $23, $23
  161. ST $f14, 0*SIZE($23)
  162. ST $f15, 1*SIZE($23)
  163. SXADDQ $18, $23, $23
  164. ST $f16, 0*SIZE($23)
  165. ST $f17, 1*SIZE($23)
  166. SXADDQ $18, $23, $23
  167. ST $f20, 0*SIZE($24)
  168. ST $f21, 1*SIZE($24)
  169. SXADDQ $20, $24, $24
  170. ST $f22, 0*SIZE($24)
  171. ST $f23, 1*SIZE($24)
  172. SXADDQ $20, $24, $24
  173. ST $f24, 0*SIZE($24)
  174. ST $f25, 1*SIZE($24)
  175. SXADDQ $20, $24, $24
  176. ST $f26, 0*SIZE($24)
  177. ST $f27, 1*SIZE($24)
  178. SXADDQ $20, $24, $24
  179. subl $21, 1, $21
  180. bgt $21, $SubLoop
  181. .align 4
  182. $SubRemain:
  183. ble $22, $SubEnd
  184. .align 4
  185. $SubRemainLoop:
  186. LD $f10, 0*SIZE($19)
  187. LD $f11, 1*SIZE($19)
  188. LD $f20, 0*SIZE($17)
  189. LD $f21, 1*SIZE($17)
  190. subl $22, 1, $22
  191. ST $f10, 0*SIZE($17)
  192. ST $f11, 1*SIZE($17)
  193. ST $f20, 0*SIZE($19)
  194. ST $f21, 1*SIZE($19)
  195. SXADDQ $18, $17, $17
  196. SXADDQ $20, $19, $19
  197. bgt $22, $SubRemainLoop
  198. .align 4
  199. $SubEnd:
  200. clr $0
  201. ret
  202. EPILOGUE