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