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.

iamin.S 6.1 kB

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