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.

zasum.S 4.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 $f23
  35. #define a2 $f9
  36. #define a3 $f10
  37. #define a4 $f11
  38. #define a5 $f12
  39. #define a6 $f13
  40. #define a7 $f14
  41. #define a8 $f15
  42. #define t1 $f16
  43. #define t2 $f17
  44. #define t3 $f0
  45. #define t4 $f1
  46. #define s1 $f22
  47. #define s2 $f8
  48. PROLOGUE
  49. #ifdef F_INTERFACE
  50. LDINT N, 0(N)
  51. LDINT INCX, 0(INCX)
  52. #endif
  53. MTC s1, $r0
  54. MTC s2, $r0
  55. slli.d INCX, INCX, ZBASE_SHIFT
  56. srai.d I, N, 2
  57. bge $r0, N, .L999
  58. bge $r0, I, .L25
  59. LD a1, X, 0 * SIZE
  60. LD a2, X, 1 * SIZE
  61. add.d X, X, INCX
  62. LD a3, X, 0 * SIZE
  63. LD a4, X, 1 * SIZE
  64. add.d X, X, INCX
  65. LD a5, X, 0 * SIZE
  66. LD a6, X, 1 * SIZE
  67. add.d X, X, INCX
  68. FABS t1, a1
  69. FABS t2, a2
  70. LD a7, X, 0 * SIZE
  71. LD a8, X, 1 * SIZE
  72. FABS t3, a3
  73. FABS t4, a4
  74. addi.d I, I, -1
  75. add.d X, X, INCX
  76. bge $r0, I, .L24
  77. .align 3
  78. .L23:
  79. ADD s1, s1, t1
  80. LD a1, X, 0 * SIZE
  81. FABS t1, a5
  82. addi.d I, I, -1
  83. ADD s2, s2, t2
  84. LD a2, X, 1 * SIZE
  85. FABS t2, a6
  86. add.d X, X, INCX
  87. ADD s1, s1, t3
  88. LD a3, X, 0 * SIZE
  89. FABS t3, a7
  90. NOP
  91. ADD s2, s2, t4
  92. LD a4, X, 1 * SIZE
  93. FABS t4, a8
  94. add.d X, X, INCX
  95. ADD s1, s1, t1
  96. LD a5, X, 0 * SIZE
  97. FABS t1, a1
  98. NOP
  99. ADD s2, s2, t2
  100. LD a6, X, 1 * SIZE
  101. FABS t2, a2
  102. add.d X, X, INCX
  103. ADD s1, s1, t3
  104. LD a7, X, 0 * SIZE
  105. FABS t3, a3
  106. LD a8, X, 1 * SIZE
  107. ADD s2, s2, t4
  108. add.d X, X, INCX
  109. FABS t4, a4
  110. blt $r0, I, .L23
  111. .align 3
  112. .L24:
  113. ADD s1, s1, t1
  114. FABS t1, a5
  115. ADD s2, s2, t2
  116. FABS t2, a6
  117. ADD s1, s1, t3
  118. FABS t3, a7
  119. ADD s2, s2, t4
  120. FABS t4, a8
  121. ADD s1, s1, t1
  122. ADD s2, s2, t2
  123. ADD s1, s1, t3
  124. ADD s2, s2, t4
  125. .align 3
  126. .L25:
  127. andi I, N, 3
  128. bge $r0, I, .L999
  129. .align 3
  130. .L26:
  131. LD a1, X, 0 * SIZE
  132. LD a2, X, 1 * SIZE
  133. FABS t1, a1
  134. addi.d I, I, -1
  135. FABS t2, a2
  136. add.d X, X, INCX
  137. ADD s1, s1, t1
  138. ADD s2, s2, t2
  139. blt $r0, I, .L26
  140. .align 3
  141. .L999:
  142. ADD s1, s1, s2
  143. move $r4, $r17
  144. fmov.d $f0, $f22
  145. jirl $r0, $r1, 0x0
  146. EPILOGUE