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.

zamax.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 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. PROLOGUE
  55. #ifdef F_INTERFACE
  56. LDINT N, 0(N)
  57. LDINT INCX, 0(INCX)
  58. #endif
  59. MTC s1, $r0
  60. bge $r0, N, .L999
  61. slli.d INCX, INCX, ZBASE_SHIFT
  62. bge $r0, INCX, .L999
  63. LD a1, X, 0 * SIZE
  64. addi.d N, N, -1
  65. LD a2, X, 1 * SIZE
  66. add.d X, X, INCX
  67. FABS t1, a1
  68. FABS t2, a2
  69. ADD s1, t1, t2
  70. bge $r0, N, .L999
  71. ADD s2, t1, t2
  72. srai.d I, N, 2
  73. ADD s3, t1, t2
  74. ADD s4, t1, t2
  75. bge $r0, I, .L15
  76. LD a1, X, 0 * SIZE
  77. LD a2, X, 1 * SIZE
  78. add.d X, X, INCX
  79. LD a3, X, 0 * SIZE
  80. LD a4, X, 1 * SIZE
  81. add.d X, X, INCX
  82. LD a5, X, 0 * SIZE
  83. LD a6, X, 1 * SIZE
  84. add.d X, X, INCX
  85. LD a7, X, 0 * SIZE
  86. LD a8, X, 1 * SIZE
  87. addi.d I, I, -1
  88. add.d X, X, INCX
  89. bge $r0, I, .L13
  90. .align 3
  91. .L12:
  92. FABS t1, a1
  93. LD a1, X, 0 * SIZE
  94. FABS t2, a2
  95. LD a2, X, 1 * SIZE
  96. FABS t3, a3
  97. add.d X, X, INCX
  98. FABS t4, a4
  99. FABS t5, a5
  100. LD a3, X, 0 * SIZE
  101. FABS t6, a6
  102. LD a4, X, 1 * SIZE
  103. FABS t7, a7
  104. add.d X, X, INCX
  105. FABS t8, a8
  106. ADD t1, t1, t2
  107. LD a5, X, 0 * SIZE
  108. ADD t3, t3, t4
  109. LD a6, X, 1 * SIZE
  110. ADD t5, t5, t6
  111. add.d X, X, INCX
  112. ADD t7, t7, t8
  113. CMPLT $fcc0, s1, t1
  114. LD a7, X, 0 * SIZE
  115. CMPLT $fcc1, s2, t3
  116. LD a8, X, 1 * SIZE
  117. CMPLT $fcc2, s3, t5
  118. add.d X, X, INCX
  119. CMPLT $fcc3, s4, t7
  120. CMOVT s1, s1, t1, $fcc0
  121. addi.d I, I, -1
  122. CMOVT s2, s2, t3, $fcc1
  123. CMOVT s3, s3, t5, $fcc2
  124. CMOVT s4, s4, t7, $fcc3
  125. blt $r0, I, .L12
  126. .align 3
  127. .L13:
  128. FABS t1, a1
  129. FABS t2, a2
  130. FABS t3, a3
  131. FABS t4, a4
  132. FABS t5, a5
  133. FABS t6, a6
  134. FABS t7, a7
  135. FABS t8, a8
  136. ADD t1, t1, t2
  137. ADD t3, t3, t4
  138. ADD t5, t5, t6
  139. ADD t7, t7, t8
  140. CMPLT $fcc0, s1, t1
  141. CMPLT $fcc1, s2, t3
  142. CMPLT $fcc2, s3, t5
  143. CMPLT $fcc3, s4, t7
  144. CMOVT s1, s1, t1, $fcc0
  145. CMOVT s2, s2, t3, $fcc1
  146. CMOVT s3, s3, t5, $fcc2
  147. CMOVT s4, s4, t7, $fcc3
  148. .align 3
  149. .L15:
  150. andi I, N, 3
  151. bge $r0, I, .L998
  152. .align 3
  153. .L16:
  154. LD a1, X, 0 * SIZE
  155. LD a2, X, 1 * SIZE
  156. addi.d I, I, -1
  157. FABS t1, a1
  158. FABS t2, a2
  159. ADD t1, t1, t2
  160. CMPLT $fcc0, s1, t1
  161. CMOVT s1, s1, t1, $fcc0
  162. add.d X, X, INCX
  163. blt $r0, I, .L16
  164. .align 3
  165. .L998:
  166. CMPLT $fcc0, s1, s2
  167. CMPLT $fcc1, s3, s4
  168. CMOVT s1, s1, s2, $fcc0
  169. CMOVT s3, s3, s4, $fcc1
  170. CMPLT $fcc0, s1, s3
  171. CMOVT s1, s1, s3, $fcc0
  172. .align 3
  173. .L999:
  174. move $r4, $r17
  175. fmov.d $f0, $f22
  176. jirl $r0, $r1, 0x0
  177. EPILOGUE