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.

izamax.S 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 $r18
  33. #define TEMP $r7
  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 t5 $f4
  47. #define t6 $f5
  48. #define t7 $f6
  49. #define t8 $f7
  50. #define s1 $f22
  51. #define s2 $f8
  52. #define s3 $f23
  53. #define s4 $f9
  54. #define x1 $r17
  55. #define x2 $r8
  56. #define x3 $r9
  57. #define x4 $r10
  58. PROLOGUE
  59. #ifdef F_INTERFACE
  60. LDINT N, 0(N)
  61. LDINT INCX, 0(INCX)
  62. #endif
  63. li.d x1, 0
  64. bge $r0, N, .L999
  65. slli.d INCX, INCX, ZBASE_SHIFT
  66. bge $r0, INCX, .L999
  67. LD a1, X, 0 * SIZE
  68. LD a2, X, 1 * SIZE
  69. FABS t1, a1
  70. FABS t2, a2
  71. ADD s1, t1, t2
  72. ADD s2, t1, t2
  73. ADD s3, t1, t2
  74. ADD s4, t1, t2
  75. addi.d N, N, -1
  76. li.d x1, 1
  77. bge $r0, N, .L999
  78. add.d X, X, INCX
  79. li.d x2, 1
  80. srai.d I, N, 2
  81. li.d x3, 1
  82. li.d TEMP, 2
  83. li.d x4, 1
  84. bge $r0, I, .L15
  85. LD a1, X, 0 * SIZE
  86. LD a2, X, 1 * SIZE
  87. add.d X, X, INCX
  88. LD a3, X, 0 * SIZE
  89. LD a4, X, 1 * SIZE
  90. add.d X, X, INCX
  91. LD a5, X, 0 * SIZE
  92. LD a6, X, 1 * SIZE
  93. add.d X, X, INCX
  94. LD a7, X, 0 * SIZE
  95. LD a8, X, 1 * SIZE
  96. addi.d I, I, -1
  97. add.d X, X, INCX
  98. bge $r0, I, .L13
  99. .align 3
  100. .L12:
  101. FABS t1, a1
  102. LD a1, X, 0 * SIZE
  103. FABS t2, a2
  104. LD a2, X, 1 * SIZE
  105. FABS t3, a3
  106. add.d X, X, INCX
  107. FABS t4, a4
  108. FABS t5, a5
  109. LD a3, X, 0 * SIZE
  110. FABS t6, a6
  111. LD a4, X, 1 * SIZE
  112. FABS t7, a7
  113. add.d X, X, INCX
  114. FABS t8, a8
  115. ADD t1, t1, t2
  116. LD a5, X, 0 * SIZE
  117. ADD t3, t3, t4
  118. LD a6, X, 1 * SIZE
  119. ADD t5, t5, t6
  120. add.d X, X, INCX
  121. ADD t7, t7, t8
  122. CMPLT $fcc0, s1, t1
  123. LD a7, X, 0 * SIZE
  124. CMPLT $fcc1, s2, t3
  125. LD a8, X, 1 * SIZE
  126. CMPLT $fcc2, s3, t5
  127. add.d X, X, INCX
  128. CMPLT $fcc3, s4, t7
  129. addi.d I, I, -1
  130. CMOVT s1, s1, t1, $fcc0
  131. MOVT(x1, TEMP, $fcc0)
  132. CMOVT s2, s2, t3, $fcc1
  133. MOVT(x2, TEMP, $fcc1)
  134. CMOVT s3, s3, t5, $fcc2
  135. MOVT(x3, TEMP, $fcc2)
  136. CMOVT s4, s4, t7, $fcc3
  137. MOVT(x4, TEMP, $fcc3)
  138. addi.d TEMP, TEMP, 4
  139. blt $r0, I, .L12
  140. .align 3
  141. .L13:
  142. FABS t1, a1
  143. FABS t2, a2
  144. FABS t3, a3
  145. FABS t4, a4
  146. FABS t5, a5
  147. FABS t6, a6
  148. FABS t7, a7
  149. FABS t8, a8
  150. ADD t1, t1, t2
  151. ADD t3, t3, t4
  152. ADD t5, t5, t6
  153. ADD t7, t7, t8
  154. CMPLT $fcc0, s1, t1
  155. CMPLT $fcc1, s2, t3
  156. CMPLT $fcc2, s3, t5
  157. CMPLT $fcc3, s4, t7
  158. CMOVT s1, s1, t1, $fcc0
  159. MOVT(x1, TEMP, $fcc0)
  160. CMOVT s2, s2, t3, $fcc1
  161. MOVT(x2, TEMP, $fcc1)
  162. CMOVT s3, s3, t5, $fcc2
  163. MOVT(x3, TEMP, $fcc2)
  164. CMOVT s4, s4, t7, $fcc3
  165. MOVT(x4, TEMP, $fcc3)
  166. addi.d TEMP, TEMP, 4
  167. addi.d x2, x2, 1
  168. addi.d x3, x3, 2
  169. addi.d x4, x4, 3
  170. .align 3
  171. .L15:
  172. andi I, N, 3
  173. bge $r0, I, .L998
  174. .align 3
  175. .L16:
  176. LD a1, X, 0 * SIZE
  177. LD a2, X, 1 * SIZE
  178. add.d X, X, INCX
  179. FABS t1, a1
  180. FABS t2, a2
  181. ADD t1, t1, t2
  182. addi.d I, I, -1
  183. CMPLT $fcc0, s1, t1
  184. CMOVT s1, s1, t1, $fcc0
  185. MOVT(x1, TEMP, $fcc0)
  186. addi.d TEMP, TEMP, 1
  187. blt $r0, I, .L16
  188. .align 3
  189. .L998:
  190. CMPLT $fcc0, s1, s2
  191. CMPLT $fcc1, s3, s4
  192. CMOVT s1, s1, s2, $fcc0
  193. MOVT(x1, x2, $fcc0)
  194. CMOVT s3, s3, s4, $fcc1
  195. MOVT(x3, x4, $fcc1)
  196. CMPLT $fcc0, s1, s3
  197. CMOVT s1, s1, s3, $fcc0
  198. MOVT(x1, x3, $fcc0)
  199. .align 3
  200. .L999:
  201. move $r4, $r17
  202. fmov.d $f0, $f22
  203. jirl $r0, $r1, 0x0
  204. EPILOGUE