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.

asum.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. #define PREFETCHSIZE 88
  42. #define N $16
  43. #define X $17
  44. #define INCX $18
  45. #define I $19
  46. #define s0 $f0
  47. #define s1 $f1
  48. #define s2 $f10
  49. #define s3 $f11
  50. #define a0 $f12
  51. #define a1 $f13
  52. #define a2 $f14
  53. #define a3 $f15
  54. #define a4 $f16
  55. #define a5 $f17
  56. #define a6 $f18
  57. #define a7 $f19
  58. #define t0 $f20
  59. #define t1 $f21
  60. #define t2 $f22
  61. #define t3 $f23
  62. PROLOGUE
  63. PROFCODE
  64. fclr s0
  65. unop
  66. fclr t0
  67. ble N, $L999
  68. sra N, 3, I
  69. fclr s1
  70. fclr s2
  71. ble I, $L15
  72. LD a0, 0 * SIZE(X)
  73. fclr t1
  74. SXADDQ INCX, X, X
  75. fclr t2
  76. LD a1, 0 * SIZE(X)
  77. fclr t3
  78. SXADDQ INCX, X, X
  79. fclr s3
  80. LD a2, 0 * SIZE(X)
  81. SXADDQ INCX, X, X
  82. LD a3, 0 * SIZE(X)
  83. SXADDQ INCX, X, X
  84. LD a4, 0 * SIZE(X)
  85. SXADDQ INCX, X, X
  86. LD a5, 0 * SIZE(X)
  87. SXADDQ INCX, X, X
  88. lda I, -1(I)
  89. ble I, $L13
  90. .align 4
  91. $L12:
  92. ADD s0, t0, s0
  93. ldl $31, PREFETCHSIZE * 2 * SIZE(X)
  94. fabs a0, t0
  95. lda I, -1(I)
  96. ADD s1, t1, s1
  97. LD a6, 0 * SIZE(X)
  98. fabs a1, t1
  99. SXADDQ INCX, X, X
  100. ADD s2, t2, s2
  101. LD a7, 0 * SIZE(X)
  102. fabs a2, t2
  103. SXADDQ INCX, X, X
  104. ADD s3, t3, s3
  105. LD a0, 0 * SIZE(X)
  106. fabs a3, t3
  107. SXADDQ INCX, X, X
  108. ADD s0, t0, s0
  109. LD a1, 0 * SIZE(X)
  110. fabs a4, t0
  111. SXADDQ INCX, X, X
  112. ADD s1, t1, s1
  113. LD a2, 0 * SIZE(X)
  114. fabs a5, t1
  115. SXADDQ INCX, X, X
  116. ADD s2, t2, s2
  117. LD a3, 0 * SIZE(X)
  118. fabs a6, t2
  119. SXADDQ INCX, X, X
  120. ADD s3, t3, s3
  121. LD a4, 0 * SIZE(X)
  122. fabs a7, t3
  123. SXADDQ INCX, X, X
  124. LD a5, 0 * SIZE(X)
  125. unop
  126. SXADDQ INCX, X, X
  127. bne I, $L12
  128. .align 4
  129. $L13:
  130. ADD s0, t0, s0
  131. LD a6, 0 * SIZE(X)
  132. fabs a0, t0
  133. SXADDQ INCX, X, X
  134. ADD s1, t1, s1
  135. LD a7, 0 * SIZE(X)
  136. fabs a1, t1
  137. SXADDQ INCX, X, X
  138. ADD s2, t2, s2
  139. fabs a2, t2
  140. ADD s3, t3, s3
  141. fabs a3, t3
  142. ADD s0, t0, s0
  143. fabs a4, t0
  144. ADD s1, t1, s1
  145. fabs a5, t1
  146. ADD s2, t2, s2
  147. fabs a6, t2
  148. ADD s3, t3, s3
  149. fabs a7, t3
  150. ADD s1, t1, s1
  151. ADD s2, t2, s2
  152. ADD s3, t3, s3
  153. ADD s0, s1, s0
  154. ADD s2, s3, s2
  155. .align 4
  156. $L15:
  157. and N, 7, I
  158. ADD s0, s2, s0
  159. unop
  160. ble I, $L999
  161. .align 4
  162. $L17:
  163. ADD s0, t0, s0
  164. LD a0, 0 * SIZE(X)
  165. SXADDQ INCX, X, X
  166. fabs a0, t0
  167. lda I, -1(I)
  168. bne I, $L17
  169. .align 4
  170. $L999:
  171. ADD s0, t0, s0
  172. ret
  173. EPILOGUE