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.

max.S 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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 N $16
  42. #define X $17
  43. #define INCX $18
  44. #ifndef USE_MIN
  45. #define CMPLT(a, b) cmptlt a, b
  46. #else
  47. #define CMPLT(a, b) cmptlt b, a
  48. #endif
  49. #define STACKSIZE 8 * 8
  50. PROLOGUE
  51. PROFCODE
  52. .frame $sp, STACKSIZE, $26, 0
  53. #ifdef F_INTERFACE
  54. ldl N, 0(N) # n
  55. ldl INCX, 0(INCX) # incx
  56. #endif
  57. lda $sp, -STACKSIZE($sp)
  58. nop
  59. .align 4
  60. cmplt $31, N, $2
  61. cmplt $31, INCX, $3
  62. SXADDQ INCX, $31, INCX
  63. and $2, $3, $0
  64. sra N, 3, $1
  65. fclr $f0
  66. unop
  67. beq $0, $End # if (n <= 0) or (incx <= 0) return
  68. .align 4
  69. LD $f0, 0 * SIZE(X)
  70. unop
  71. unop
  72. ble $1, $L15
  73. .align 4
  74. fmov $f0, $f1
  75. addq X, INCX, X
  76. fmov $f0, $f10
  77. lda $1, -1($1)
  78. LD $f21, 0 * SIZE(X)
  79. fmov $f0, $f11
  80. addq X, INCX, X
  81. fmov $f0, $f12
  82. LD $f22, 0 * SIZE(X)
  83. fmov $f0, $f13
  84. addq X, INCX, X
  85. fmov $f0, $f14
  86. LD $f23, 0 * SIZE(X)
  87. fmov $f0, $f15
  88. addq X, INCX, X
  89. fmov $f0, $f20
  90. LD $f24, 0 * SIZE(X)
  91. addq X, INCX, X
  92. LD $f25, 0 * SIZE(X)
  93. addq X, INCX, X
  94. LD $f26, 0 * SIZE(X)
  95. addq X, INCX, X
  96. LD $f27, 0 * SIZE(X)
  97. addq X, INCX, X
  98. CMPLT($f0, $f20), $f16
  99. CMPLT($f1, $f21), $f17
  100. CMPLT($f10, $f22), $f18
  101. CMPLT($f11, $f23), $f19
  102. ble $1, $L13
  103. .align 4
  104. $L12:
  105. fcmovne $f16, $f20, $f0
  106. LD $f20, 0 * SIZE(X)
  107. CMPLT($f12, $f24), $f16
  108. addq X, INCX, X
  109. fcmovne $f17, $f21, $f1
  110. LD $f21, 0 * SIZE(X)
  111. CMPLT($f13, $f25), $f17
  112. addq X, INCX, X
  113. fcmovne $f18, $f22, $f10
  114. LD $f22, 0 * SIZE(X)
  115. CMPLT($f14, $f26), $f18
  116. addq X, INCX, X
  117. fcmovne $f19, $f23, $f11
  118. LD $f23, 0 * SIZE(X)
  119. CMPLT($f15, $f27), $f19
  120. addq X, INCX, X
  121. fcmovne $f16, $f24, $f12
  122. LD $f24, 0 * SIZE(X)
  123. CMPLT($f0, $f20), $f16
  124. addq X, INCX, X
  125. fcmovne $f17, $f25, $f13
  126. LD $f25, 0 * SIZE(X)
  127. CMPLT($f1, $f21), $f17
  128. addq X, INCX, X
  129. fcmovne $f18, $f26, $f14
  130. LD $f26, 0 * SIZE(X)
  131. CMPLT($f10, $f22), $f18
  132. addq X, INCX, X
  133. fcmovne $f19, $f27, $f15
  134. LD $f27, 0 * SIZE(X)
  135. CMPLT($f11, $f23), $f19
  136. lda $1, -1($1) # i --
  137. addq X, INCX, X
  138. unop
  139. unop
  140. bgt $1,$L12
  141. .align 4
  142. $L13:
  143. fcmovne $f16, $f20, $f0
  144. CMPLT($f12, $f24), $f16
  145. fcmovne $f17, $f21, $f1
  146. CMPLT($f13, $f25), $f17
  147. fcmovne $f18, $f22, $f10
  148. CMPLT($f14, $f26), $f18
  149. fcmovne $f19, $f23, $f11
  150. CMPLT($f15, $f27), $f19
  151. fcmovne $f16, $f24, $f12
  152. CMPLT($f0, $f1), $f16
  153. fcmovne $f17, $f25, $f13
  154. CMPLT($f10, $f11), $f17
  155. fcmovne $f18, $f26, $f14
  156. CMPLT($f12, $f13), $f18
  157. fcmovne $f19, $f27, $f15
  158. CMPLT($f14, $f15), $f19
  159. fcmovne $f16, $f1, $f0
  160. fcmovne $f17, $f11, $f10
  161. fcmovne $f18, $f13, $f12
  162. fcmovne $f19, $f15, $f14
  163. CMPLT($f0, $f10), $f16
  164. CMPLT($f12, $f14), $f17
  165. fcmovne $f16, $f10, $f0
  166. fcmovne $f17, $f14, $f12
  167. CMPLT($f0, $f12), $f16
  168. fcmovne $f16, $f12, $f0
  169. .align 4
  170. $L15:
  171. and N, 7, $1
  172. unop
  173. unop
  174. ble $1, $End
  175. .align 4
  176. $L16:
  177. LD $f20, 0 * SIZE(X)
  178. addq X, INCX, X
  179. CMPLT($f0, $f20), $f16
  180. fcmovne $f16, $f20, $f0
  181. lda $1, -1($1) # i --
  182. bgt $1, $L16
  183. .align 4
  184. $End:
  185. lda $sp, STACKSIZE($sp)
  186. ret
  187. EPILOGUE