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.

amin.S 5.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 $4
  41. #define X $5
  42. #define INCX $6
  43. #define I $2
  44. #define TEMP $3
  45. #define a1 $f4
  46. #define a2 $f5
  47. #define a3 $f6
  48. #define a4 $f7
  49. #define a5 $f8
  50. #define a6 $f9
  51. #define a7 $f10
  52. #define a8 $f11
  53. #define t1 $f12
  54. #define t2 $f13
  55. #define t3 $f14
  56. #define t4 $f15
  57. #define s1 $f0
  58. #define s2 $f1
  59. #define s3 $f2
  60. #define s4 $f3
  61. PROLOGUE
  62. #ifdef F_INTERFACE
  63. LDINT N, 0(N)
  64. LDINT INCX, 0(INCX)
  65. #endif
  66. blez N, .L999
  67. MTC $0, s1
  68. blez INCX, .L999
  69. dsll INCX, INCX, BASE_SHIFT
  70. LD a1, 0 * SIZE(X)
  71. daddiu N, N, -1
  72. daddu X, X, INCX
  73. FABS s1, a1
  74. blez N, .L999
  75. FABS s2, a1
  76. FABS s3, a1
  77. dsra I, N, 3
  78. blez I, .L15
  79. FABS s4, a1
  80. LD a1, 0 * SIZE(X)
  81. daddu X, X, INCX
  82. LD a2, 0 * SIZE(X)
  83. daddu X, X, INCX
  84. LD a3, 0 * SIZE(X)
  85. daddu X, X, INCX
  86. LD a4, 0 * SIZE(X)
  87. daddu X, X, INCX
  88. LD a5, 0 * SIZE(X)
  89. daddu X, X, INCX
  90. LD a6, 0 * SIZE(X)
  91. daddu X, X, INCX
  92. LD a7, 0 * SIZE(X)
  93. daddu X, X, INCX
  94. LD a8, 0 * SIZE(X)
  95. daddiu I, I, -1
  96. blez I, .L13
  97. daddu X, X, INCX
  98. .align 3
  99. .L12:
  100. FABS t1, a1
  101. LD a1, 0 * SIZE(X)
  102. FABS t2, a2
  103. daddu X, X, INCX
  104. FABS t3, a3
  105. LD a2, 0 * SIZE(X)
  106. FABS t4, a4
  107. daddu X, X, INCX
  108. CMPLT $fcc0, t1, s1
  109. LD a3, 0 * SIZE(X)
  110. CMPLT $fcc1, t2, s2
  111. daddu X, X, INCX
  112. CMPLT $fcc2, t3, s3
  113. LD a4, 0 * SIZE(X)
  114. CMPLT $fcc3, t4, s4
  115. daddu X, X, INCX
  116. CMOVT s1, t1, $fcc0
  117. CMOVT s2, t2, $fcc1
  118. CMOVT s3, t3, $fcc2
  119. CMOVT s4, t4, $fcc3
  120. FABS t1, a5
  121. LD a5, 0 * SIZE(X)
  122. FABS t2, a6
  123. daddu X, X, INCX
  124. FABS t3, a7
  125. LD a6, 0 * SIZE(X)
  126. FABS t4, a8
  127. daddu X, X, INCX
  128. CMPLT $fcc0, t1, s1
  129. LD a7, 0 * SIZE(X)
  130. CMPLT $fcc1, t2, s2
  131. daddu X, X, INCX
  132. CMPLT $fcc2, t3, s3
  133. LD a8, 0 * SIZE(X)
  134. CMPLT $fcc3, t4, s4
  135. daddu X, X, INCX
  136. CMOVT s1, t1, $fcc0
  137. daddiu I, I, -1
  138. CMOVT s2, t2, $fcc1
  139. CMOVT s3, t3, $fcc2
  140. bgtz I, .L12
  141. CMOVT s4, t4, $fcc3
  142. .align 3
  143. .L13:
  144. FABS t1, a1
  145. FABS t2, a2
  146. FABS t3, a3
  147. FABS t4, a4
  148. CMPLT $fcc0, t1, s1
  149. CMPLT $fcc1, t2, s2
  150. CMPLT $fcc2, t3, s3
  151. CMPLT $fcc3, t4, s4
  152. CMOVT s1, t1, $fcc0
  153. CMOVT s2, t2, $fcc1
  154. CMOVT s3, t3, $fcc2
  155. CMOVT s4, t4, $fcc3
  156. FABS t1, a5
  157. FABS t2, a6
  158. FABS t3, a7
  159. FABS t4, a8
  160. CMPLT $fcc0, t1, s1
  161. CMPLT $fcc1, t2, s2
  162. CMPLT $fcc2, t3, s3
  163. CMPLT $fcc3, t4, s4
  164. CMOVT s1, t1, $fcc0
  165. CMOVT s2, t2, $fcc1
  166. CMOVT s3, t3, $fcc2
  167. CMOVT s4, t4, $fcc3
  168. .align 3
  169. .L15:
  170. andi I, N, 7
  171. blez I, .L998
  172. NOP
  173. .align 3
  174. .L16:
  175. LD a1, 0 * SIZE(X)
  176. daddiu I, I, -1
  177. FABS t1, a1
  178. CMPLT $fcc0, t1, s1
  179. CMOVT s1, t1, $fcc0
  180. bgtz I, .L16
  181. daddu X, X, INCX
  182. .align 3
  183. .L998:
  184. CMPLT $fcc0, s2, s1
  185. CMPLT $fcc1, s4, s3
  186. CMOVT s1, s2, $fcc0
  187. CMOVT s3, s4, $fcc1
  188. CMPLT $fcc0, s3, s1
  189. CMOVT s1, s3, $fcc0
  190. .align 3
  191. .L999:
  192. j $31
  193. NOP
  194. EPILOGUE