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.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /***************************************************************************
  2. Copyright (c) 2021, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  25. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *****************************************************************************/
  27. #define ASSEMBLER
  28. #include "common.h"
  29. #define N $r4
  30. #define X $r5
  31. #define INCX $r6
  32. #define I $r17
  33. #define TEMP $r18
  34. #define a1 $f10
  35. #define a2 $f11
  36. #define a3 $f12
  37. #define a4 $f13
  38. #define a5 $f14
  39. #define a6 $f15
  40. #define a7 $f16
  41. #define a8 $f17
  42. #define t1 $f0
  43. #define t2 $f1
  44. #define t3 $f2
  45. #define t4 $f3
  46. #define s1 $f22
  47. #define s2 $f8
  48. #define s3 $f23
  49. #define s4 $f9
  50. PROLOGUE
  51. #ifdef F_INTERFACE
  52. LDINT N, 0(N)
  53. LDINT INCX, 0(INCX)
  54. #endif
  55. MTC s1, $r0
  56. bge $r0, N, .L999
  57. slli.d INCX, INCX, BASE_SHIFT
  58. bge $r0, INCX, .L999
  59. LD a1, X, 0 * SIZE
  60. addi.d N, N, -1
  61. add.d X, X, INCX
  62. FABS s1, a1
  63. FABS s2, a1
  64. bge $r0, N, .L999
  65. FABS s3, a1
  66. srai.d I, N, 3
  67. FABS s4, a1
  68. bge $r0, I, .L15
  69. LD a1, X, 0 * SIZE
  70. add.d X, X, INCX
  71. LD a2, X, 0 * SIZE
  72. add.d X, X, INCX
  73. LD a3, X, 0 * SIZE
  74. add.d X, X, INCX
  75. LD a4, X, 0 * SIZE
  76. add.d X, X, INCX
  77. LD a5, X, 0 * SIZE
  78. add.d X, X, INCX
  79. LD a6, X, 0 * SIZE
  80. add.d X, X, INCX
  81. LD a7, X, 0 * SIZE
  82. add.d X, X, INCX
  83. LD a8, X, 0 * SIZE
  84. addi.d I, I, -1
  85. add.d X, X, INCX
  86. bge $r0, I, .L13
  87. .align 3
  88. .L12:
  89. FABS t1, a1
  90. LD a1, X, 0 * SIZE
  91. FABS t2, a2
  92. add.d X, X, INCX
  93. FABS t3, a3
  94. LD a2, X, 0 * SIZE
  95. FABS t4, a4
  96. add.d X, X, INCX
  97. CMPLT $fcc0, t1, s1
  98. LD a3, X, 0 * SIZE
  99. CMPLT $fcc1, t2, s2
  100. add.d X, X, INCX
  101. CMPLT $fcc2, t3, s3
  102. LD a4, X, 0 * SIZE
  103. CMPLT $fcc3, t4, s4
  104. add.d X, X, INCX
  105. CMOVT s1, s1, t1, $fcc0
  106. CMOVT s2, s2, t2, $fcc1
  107. CMOVT s3, s3, t3, $fcc2
  108. CMOVT s4, s4, t4, $fcc3
  109. FABS t1, a5
  110. LD a5, X, 0 * SIZE
  111. FABS t2, a6
  112. add.d X, X, INCX
  113. FABS t3, a7
  114. LD a6, X, 0 * SIZE
  115. FABS t4, a8
  116. add.d X, X, INCX
  117. CMPLT $fcc0, t1, s1
  118. LD a7, X, 0 * SIZE
  119. CMPLT $fcc1, t2, s2
  120. add.d X, X, INCX
  121. CMPLT $fcc2, t3, s3
  122. LD a8, X, 0 * SIZE
  123. CMPLT $fcc3, t4, s4
  124. add.d X, X, INCX
  125. CMOVT s1, s1, t1, $fcc0
  126. addi.d I, I, -1
  127. CMOVT s2, s2, t2, $fcc1
  128. CMOVT s3, s3, t3, $fcc2
  129. CMOVT s4, s4, t4, $fcc3
  130. blt $r0, I, .L12
  131. .align 3
  132. .L13:
  133. FABS t1, a1
  134. FABS t2, a2
  135. FABS t3, a3
  136. FABS t4, a4
  137. CMPLT $fcc0, t1, s1
  138. CMPLT $fcc1, t2, s2
  139. CMPLT $fcc2, t3, s3
  140. CMPLT $fcc3, t4, s4
  141. CMOVT s1, s1, t1, $fcc0
  142. CMOVT s2, s2, t2, $fcc1
  143. CMOVT s3, s3, t3, $fcc2
  144. CMOVT s4, s4, t4, $fcc3
  145. FABS t1, a5
  146. FABS t2, a6
  147. FABS t3, a7
  148. FABS t4, a8
  149. CMPLT $fcc0, t1, s1
  150. CMPLT $fcc1, t2, s2
  151. CMPLT $fcc2, t3, s3
  152. CMPLT $fcc3, t4, s4
  153. CMOVT s1, s1, t1, $fcc0
  154. CMOVT s2, s2, t2, $fcc1
  155. CMOVT s3, s3, t3, $fcc2
  156. CMOVT s4, s4, t4, $fcc3
  157. .align 3
  158. .L15:
  159. andi I, N, 7
  160. NOP
  161. bge $r0, I, .L998
  162. .align 3
  163. .L16:
  164. LD a1, X, 0 * SIZE
  165. addi.d I, I, -1
  166. FABS t1, a1
  167. CMPLT $fcc0, t1, s1
  168. CMOVT s1, s1, t1, $fcc0
  169. add.d X, X, INCX
  170. blt $r0, I, .L16
  171. .align 3
  172. .L998:
  173. CMPLT $fcc0, s2, s1
  174. CMPLT $fcc1, s4, s3
  175. CMOVT s1, s1, s2, $fcc0
  176. CMOVT s3, s3, s4, $fcc1
  177. CMPLT $fcc0, s3, s1
  178. CMOVT s1, s1, s3, $fcc0
  179. .align 3
  180. .L999:
  181. move $r4, $r17
  182. fmov.d $f0, $f22
  183. jirl $r0, $r1, 0x0
  184. EPILOGUE