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.

min.S 4.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 s1 $f22
  43. #define s2 $f8
  44. #define s3 $f23
  45. #define s4 $f9
  46. PROLOGUE
  47. #ifdef F_INTERFACE
  48. LDINT N, 0(N)
  49. LDINT INCX, 0(INCX)
  50. #endif
  51. MTC s1, $r0
  52. bge $r0, N, .L999
  53. slli.d INCX, INCX, BASE_SHIFT
  54. bge $r0, INCX, .L999
  55. LD s1, X, 0 * SIZE
  56. addi.d N, N, -1
  57. add.d X, X, INCX
  58. MOV s2, s1
  59. bge $r0, N, .L999
  60. MOV s3, s1
  61. srai.d I, N, 3
  62. MOV s4, s1
  63. bge $r0, I, .L15
  64. LD a1, X, 0 * SIZE
  65. add.d X, X, INCX
  66. LD a2, X, 0 * SIZE
  67. add.d X, X, INCX
  68. LD a3, X, 0 * SIZE
  69. add.d X, X, INCX
  70. LD a4, X, 0 * SIZE
  71. add.d X, X, INCX
  72. LD a5, X, 0 * SIZE
  73. add.d X, X, INCX
  74. LD a6, X, 0 * SIZE
  75. addi.d I, I, -1
  76. add.d X, X, INCX
  77. bge $r0, I, .L13
  78. .align 3
  79. .L12:
  80. CMPLT $fcc0, a1, s1
  81. LD a7, X, 0 * SIZE
  82. CMPLT $fcc1, a2, s2
  83. add.d X, X, INCX
  84. CMPLT $fcc2, a3, s3
  85. LD a8, X, 0 * SIZE
  86. CMPLT $fcc3, a4, s4
  87. add.d X, X, INCX
  88. CMOVT s1, s1, a1, $fcc0
  89. LD a1, X, 0 * SIZE
  90. CMOVT s2, s2, a2, $fcc1
  91. add.d X, X, INCX
  92. CMOVT s3, s3, a3, $fcc2
  93. LD a2, X, 0 * SIZE
  94. CMOVT s4, s4, a4, $fcc3
  95. add.d X, X, INCX
  96. CMPLT $fcc0, a5, s1
  97. LD a3, X, 0 * SIZE
  98. CMPLT $fcc1, a6, s2
  99. add.d X, X, INCX
  100. CMPLT $fcc2, a7, s3
  101. LD a4, X, 0 * SIZE
  102. CMPLT $fcc3, a8, s4
  103. add.d X, X, INCX
  104. CMOVT s1, s1, a5, $fcc0
  105. LD a5, X, 0 * SIZE
  106. CMOVT s2, s2, a6, $fcc1
  107. add.d X, X, INCX
  108. CMOVT s3, s3, a7, $fcc2
  109. LD a6, X, 0 * SIZE
  110. CMOVT s4, s4, a8, $fcc3
  111. addi.d I, I, -1
  112. add.d X, X, INCX
  113. blt $r0, I, .L12
  114. .align 3
  115. .L13:
  116. CMPLT $fcc0, a1, s1
  117. LD a7, X, 0 * SIZE
  118. CMPLT $fcc1, a2, s2
  119. add.d X, X, INCX
  120. CMPLT $fcc2, a3, s3
  121. LD a8, X, 0 * SIZE
  122. CMPLT $fcc3, a4, s4
  123. add.d X, X, INCX
  124. CMOVT s1, s1, a1, $fcc0
  125. CMOVT s2, s2, a2, $fcc1
  126. CMOVT s3, s3, a3, $fcc2
  127. CMOVT s4, s4, a4, $fcc3
  128. CMPLT $fcc0, a5, s1
  129. CMPLT $fcc1, a6, s2
  130. CMPLT $fcc2, a7, s3
  131. CMPLT $fcc3, a8, s4
  132. CMOVT s1, s1, a5, $fcc0
  133. CMOVT s2, s2, a6, $fcc1
  134. CMOVT s3, s3, a7, $fcc2
  135. CMOVT s4, s4, a8, $fcc3
  136. .align 3
  137. .L15:
  138. andi I, N, 7
  139. bge $r0, I, .L998
  140. .align 3
  141. .L16:
  142. LD a1, X, 0 * SIZE
  143. addi.d I, I, -1
  144. CMPLT $fcc0, a1, s1
  145. CMOVT s1, s1, a1, $fcc0
  146. add.d X, X, INCX
  147. blt $r0, I, .L16
  148. .align 3
  149. .L998:
  150. CMPLT $fcc0, s2, s1
  151. CMPLT $fcc1, s4, s3
  152. CMOVT s1, s1, s2, $fcc0
  153. CMOVT s3, s3, s4, $fcc1
  154. CMPLT $fcc0, s3, s1
  155. CMOVT s1, s1, s3, $fcc0
  156. .align 3
  157. .L999:
  158. move $r4, $r17
  159. fmov.d $f0, $f22
  160. jirl $r0, $r1, 0x0
  161. EPILOGUE