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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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 $3
  44. #define TEMP $7
  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. #define x1 $2
  62. #define x2 $8
  63. #define x3 $9
  64. #define x4 $10
  65. PROLOGUE
  66. #ifdef F_INTERFACE
  67. LDINT N, 0(N)
  68. LDINT INCX, 0(INCX)
  69. #endif
  70. blez N, .L999
  71. li x1, 0
  72. blez INCX, .L999
  73. dsll INCX, INCX, BASE_SHIFT
  74. LD s1, 0 * SIZE(X)
  75. daddiu N, N, -1
  76. blez N, .L999
  77. li x1, 1
  78. daddu X, X, INCX
  79. MOV s2, s1
  80. li x2, 1
  81. MOV s3, s1
  82. dsra I, N, 3
  83. MOV s4, s1
  84. li x3, 1
  85. li TEMP, 2
  86. blez I, .L15
  87. li x4, 1
  88. LD a1, 0 * SIZE(X)
  89. daddu X, X, INCX
  90. LD a2, 0 * SIZE(X)
  91. daddu X, X, INCX
  92. LD a3, 0 * SIZE(X)
  93. daddu X, X, INCX
  94. LD a4, 0 * SIZE(X)
  95. daddu X, X, INCX
  96. LD a5, 0 * SIZE(X)
  97. daddu X, X, INCX
  98. LD a6, 0 * SIZE(X)
  99. daddiu I, I, -1
  100. blez I, .L13
  101. daddu X, X, INCX
  102. .align 3
  103. .L12:
  104. CMPLT $fcc0, s1, a1
  105. LD a7, 0 * SIZE(X)
  106. CMPLT $fcc1, s2, a2
  107. daddu X, X, INCX
  108. CMPLT $fcc2, s3, a3
  109. LD a8, 0 * SIZE(X)
  110. CMPLT $fcc3, s4, a4
  111. daddu X, X, INCX
  112. CMOVT s1, a1, $fcc0
  113. movt x1, TEMP, $fcc0
  114. CMOVT s2, a2, $fcc1
  115. movt x2, TEMP, $fcc1
  116. LD a1, 0 * SIZE(X)
  117. daddu X, X, INCX
  118. LD a2, 0 * SIZE(X)
  119. daddu X, X, INCX
  120. CMOVT s3, a3, $fcc2
  121. movt x3, TEMP, $fcc2
  122. CMOVT s4, a4, $fcc3
  123. movt x4, TEMP, $fcc3
  124. daddiu TEMP, TEMP, 4
  125. daddiu I, I, -1
  126. CMPLT $fcc0, s1, a5
  127. LD a3, 0 * SIZE(X)
  128. CMPLT $fcc1, s2, a6
  129. daddu X, X, INCX
  130. CMPLT $fcc2, s3, a7
  131. LD a4, 0 * SIZE(X)
  132. CMPLT $fcc3, s4, a8
  133. daddu X, X, INCX
  134. CMOVT s1, a5, $fcc0
  135. movt x1, TEMP, $fcc0
  136. CMOVT s2, a6, $fcc1
  137. movt x2, TEMP, $fcc1
  138. CMOVT s3, a7, $fcc2
  139. movt x3, TEMP, $fcc2
  140. CMOVT s4, a8, $fcc3
  141. movt x4, TEMP, $fcc3
  142. LD a5, 0 * SIZE(X)
  143. daddu X, X, INCX
  144. LD a6, 0 * SIZE(X)
  145. daddu X, X, INCX
  146. bgtz I, .L12
  147. daddiu TEMP, TEMP, 4
  148. .align 3
  149. .L13:
  150. CMPLT $fcc0, s1, a1
  151. LD a7, 0 * SIZE(X)
  152. CMPLT $fcc1, s2, a2
  153. daddu X, X, INCX
  154. CMPLT $fcc2, s3, a3
  155. LD a8, 0 * SIZE(X)
  156. CMPLT $fcc3, s4, a4
  157. daddu X, X, INCX
  158. CMOVT s1, a1, $fcc0
  159. movt x1, TEMP, $fcc0
  160. CMOVT s2, a2, $fcc1
  161. movt x2, TEMP, $fcc1
  162. CMOVT s3, a3, $fcc2
  163. movt x3, TEMP, $fcc2
  164. CMOVT s4, a4, $fcc3
  165. movt x4, TEMP, $fcc3
  166. CMPLT $fcc0, s1, a5
  167. daddiu TEMP, TEMP, 4
  168. CMPLT $fcc1, s2, a6
  169. NOP
  170. CMPLT $fcc2, s3, a7
  171. CMPLT $fcc3, s4, a8
  172. CMOVT s1, a5, $fcc0
  173. movt x1, TEMP, $fcc0
  174. CMOVT s2, a6, $fcc1
  175. movt x2, TEMP, $fcc1
  176. CMOVT s3, a7, $fcc2
  177. movt x3, TEMP, $fcc2
  178. CMOVT s4, a8, $fcc3
  179. movt x4, TEMP, $fcc3
  180. daddiu TEMP, TEMP, 4
  181. daddiu x2, x2, 1
  182. daddiu x3, x3, 2
  183. daddiu x4, x4, 3
  184. .align 3
  185. .L15:
  186. andi I, N, 7
  187. blez I, .L998
  188. NOP
  189. .align 3
  190. .L16:
  191. LD a1, 0 * SIZE(X)
  192. daddu X, X, INCX
  193. daddiu I, I, -1
  194. CMPLT $fcc0, s1, a1
  195. NOP
  196. CMOVT s1, a1, $fcc0
  197. movt x1, TEMP, $fcc0
  198. bgtz I, .L16
  199. daddiu TEMP, TEMP, 1
  200. .align 3
  201. .L998:
  202. CMPLT $fcc0, s1, s2
  203. CMPLT $fcc1, s3, s4
  204. CMOVT s1, s2, $fcc0
  205. movt x1, x2, $fcc0
  206. CMOVT s3, s4, $fcc1
  207. movt x3, x4, $fcc1
  208. CMPLT $fcc0, s1, s3
  209. CMOVT s1, s3, $fcc0
  210. movt x1, x3, $fcc0
  211. .align 3
  212. .L999:
  213. j $31
  214. NOP
  215. EPILOGUE