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.

zamin.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. NOP
  72. ADD s2, t1, t2
  73. srai.d I, N, 2
  74. ADD s3, t1, t2
  75. ADD s4, t1, t2
  76. bge $r0, I, .L15
  77. LD a1, X, 0 * SIZE
  78. LD a2, X, 1 * SIZE
  79. add.d X, X, INCX
  80. LD a3, X, 0 * SIZE
  81. LD a4, X, 1 * SIZE
  82. add.d X, X, INCX
  83. LD a5, X, 0 * SIZE
  84. LD a6, X, 1 * SIZE
  85. add.d X, X, INCX
  86. LD a7, X, 0 * SIZE
  87. LD a8, X, 1 * SIZE
  88. addi.d I, I, -1
  89. add.d X, X, INCX
  90. bge $r0, I, .L13
  91. .align 3
  92. .L12:
  93. FABS t1, a1
  94. LD a1, X, 0 * SIZE
  95. FABS t2, a2
  96. LD a2, X, 1 * SIZE
  97. FABS t3, a3
  98. add.d X, X, INCX
  99. FABS t4, a4
  100. NOP
  101. FABS t5, a5
  102. LD a3, X, 0 * SIZE
  103. FABS t6, a6
  104. LD a4, X, 1 * SIZE
  105. FABS t7, a7
  106. add.d X, X, INCX
  107. FABS t8, a8
  108. NOP
  109. ADD t1, t1, t2
  110. LD a5, X, 0 * SIZE
  111. ADD t3, t3, t4
  112. LD a6, X, 1 * SIZE
  113. ADD t5, t5, t6
  114. add.d X, X, INCX
  115. ADD t7, t7, t8
  116. NOP
  117. CMPLT $fcc0, t1, s1
  118. LD a7, X, 0 * SIZE
  119. CMPLT $fcc1, t3, s2
  120. LD a8, X, 1 * SIZE
  121. CMPLT $fcc2, t5, s3
  122. add.d X, X, INCX
  123. CMPLT $fcc3, t7, s4
  124. NOP
  125. CMOVT s1, s1, t1, $fcc0
  126. addi.d I, I, -1
  127. CMOVT s2, s2, t3, $fcc1
  128. NOP
  129. CMOVT s3, s3, t5, $fcc2
  130. CMOVT s4, s4, t7, $fcc3
  131. blt $r0, I, .L12
  132. NOP
  133. .align 3
  134. .L13:
  135. FABS t1, a1
  136. FABS t2, a2
  137. FABS t3, a3
  138. FABS t4, a4
  139. FABS t5, a5
  140. FABS t6, a6
  141. FABS t7, a7
  142. FABS t8, a8
  143. ADD t1, t1, t2
  144. ADD t3, t3, t4
  145. ADD t5, t5, t6
  146. ADD t7, t7, t8
  147. CMPLT $fcc0, t1, s1
  148. CMPLT $fcc1, t3, s2
  149. CMPLT $fcc2, t5, s3
  150. CMPLT $fcc3, t7, s4
  151. CMOVT s1, s1, t1, $fcc0
  152. CMOVT s2, s2, t3, $fcc1
  153. CMOVT s3, s3, t5, $fcc2
  154. CMOVT s4, s4, t7, $fcc3
  155. .align 3
  156. .L15:
  157. andi I, N, 3
  158. bge $r0, I, .L998
  159. .align 3
  160. .L16:
  161. LD a1, X, 0 * SIZE
  162. LD a2, X, 1 * SIZE
  163. addi.d I, I, -1
  164. FABS t1, a1
  165. FABS t2, a2
  166. ADD t1, t1, t2
  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. NOP
  185. EPILOGUE