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.

zcopy.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 Y $r7
  33. #define INCY $r8
  34. #define I $r17
  35. #define TEMP $r18
  36. #define a1 $f22
  37. #define a2 $f8
  38. #define a3 $f23
  39. #define a4 $f9
  40. #define a5 $f10
  41. #define a6 $f11
  42. #define a7 $f12
  43. #define a8 $f13
  44. PROLOGUE
  45. #ifdef F_INTERFACE
  46. LDINT N, 0(N)
  47. LDINT INCX, 0(INCX)
  48. LDINT INCY, 0(INCY)
  49. #endif
  50. li.d TEMP, 2 * SIZE
  51. NOP
  52. slli.d INCX, INCX, ZBASE_SHIFT
  53. bge $r0, N, .L999
  54. slli.d INCY, INCY, ZBASE_SHIFT
  55. bne INCX, TEMP, .L20
  56. srai.d I, N, 2
  57. bne INCY, TEMP, .L20
  58. addi.d I, I, -1
  59. blt I, $r0, .L15
  60. LD a1, X, 0 * SIZE
  61. LD a2, X, 1 * SIZE
  62. LD a3, X, 2 * SIZE
  63. LD a4, X, 3 * SIZE
  64. LD a5, X, 4 * SIZE
  65. LD a6, X, 5 * SIZE
  66. LD a7, X, 6 * SIZE
  67. LD a8, X, 7 * SIZE
  68. bge $r0, I, .L13
  69. .align 3
  70. .L12:
  71. ST a1, Y, 0 * SIZE
  72. LD a1, X, 8 * SIZE
  73. ST a2, Y, 1 * SIZE
  74. LD a2, X, 9 * SIZE
  75. ST a3, Y, 2 * SIZE
  76. LD a3, X, 10 * SIZE
  77. ST a4, Y, 3 * SIZE
  78. LD a4, X, 11 * SIZE
  79. ST a5, Y, 4 * SIZE
  80. LD a5, X, 12 * SIZE
  81. ST a6, Y, 5 * SIZE
  82. LD a6, X, 13 * SIZE
  83. ST a7, Y, 6 * SIZE
  84. LD a7, X, 14 * SIZE
  85. ST a8, Y, 7 * SIZE
  86. LD a8, X, 15 * SIZE
  87. addi.d I, I, -1
  88. addi.d X, X, 8 * SIZE
  89. addi.d Y, Y, 8 * SIZE
  90. blt $r0, I, .L12
  91. .align 3
  92. .L13:
  93. ST a1, Y, 0 * SIZE
  94. ST a2, Y, 1 * SIZE
  95. ST a3, Y, 2 * SIZE
  96. ST a4, Y, 3 * SIZE
  97. ST a5, Y, 4 * SIZE
  98. ST a6, Y, 5 * SIZE
  99. ST a7, Y, 6 * SIZE
  100. ST a8, Y, 7 * SIZE
  101. addi.d X, X, 8 * SIZE
  102. addi.d Y, Y, 8 * SIZE
  103. .align 3
  104. .L15:
  105. andi I, N, 3
  106. bge $r0, I, .L999
  107. .align 3
  108. .L16:
  109. LD a1, X, 0 * SIZE
  110. LD a2, X, 1 * SIZE
  111. addi.d X, X, 2 * SIZE
  112. addi.d Y, Y, 2 * SIZE
  113. ST a1, Y, -2 * SIZE
  114. addi.d I, I, -1
  115. ST a2, Y, -1 * SIZE
  116. blt $r0, I, .L16
  117. move $r4, $r17
  118. fmov.d $f0, $f22
  119. jirl $r0, $r1, 0x0
  120. NOP
  121. .align 3
  122. .L20:
  123. srai.d I, N, 2
  124. addi.d I, I, -1
  125. blt I, $r0, .L25
  126. LD a1, X, 0 * SIZE
  127. LD a2, X, 1 * SIZE
  128. add.d X, X, INCX
  129. LD a3, X, 0 * SIZE
  130. LD a4, X, 1 * SIZE
  131. add.d X, X, INCX
  132. LD a5, X, 0 * SIZE
  133. LD a6, X, 1 * SIZE
  134. add.d X, X, INCX
  135. LD a7, X, 0 * SIZE
  136. LD a8, X, 1 * SIZE
  137. add.d X, X, INCX
  138. bge $r0, I, .L23
  139. .align 3
  140. .L22:
  141. ST a1, Y, 0 * SIZE
  142. LD a1, X, 0 * SIZE
  143. ST a2, Y, 1 * SIZE
  144. add.d Y, Y, INCY
  145. LD a2, X, 1 * SIZE
  146. add.d X, X, INCX
  147. ST a3, Y, 0 * SIZE
  148. LD a3, X, 0 * SIZE
  149. ST a4, Y, 1 * SIZE
  150. add.d Y, Y, INCY
  151. LD a4, X, 1 * SIZE
  152. add.d X, X, INCX
  153. ST a5, Y, 0 * SIZE
  154. LD a5, X, 0 * SIZE
  155. ST a6, Y, 1 * SIZE
  156. add.d Y, Y, INCY
  157. LD a6, X, 1 * SIZE
  158. add.d X, X, INCX
  159. ST a7, Y, 0 * SIZE
  160. LD a7, X, 0 * SIZE
  161. ST a8, Y, 1 * SIZE
  162. add.d Y, Y, INCY
  163. LD a8, X, 1 * SIZE
  164. addi.d I, I, -1
  165. add.d X, X, INCX
  166. blt $r0, I, .L22
  167. .align 3
  168. .L23:
  169. ST a1, Y, 0 * SIZE
  170. ST a2, Y, 1 * SIZE
  171. add.d Y, Y, INCY
  172. ST a3, Y, 0 * SIZE
  173. ST a4, Y, 1 * SIZE
  174. add.d Y, Y, INCY
  175. ST a5, Y, 0 * SIZE
  176. ST a6, Y, 1 * SIZE
  177. add.d Y, Y, INCY
  178. ST a7, Y, 0 * SIZE
  179. ST a8, Y, 1 * SIZE
  180. add.d Y, Y, INCY
  181. .align 3
  182. .L25:
  183. andi I, N, 3
  184. bge $r0, I, .L999
  185. .align 3
  186. .L26:
  187. LD a1, X, 0 * SIZE
  188. LD a2, X, 1 * SIZE
  189. add.d X, X, INCX
  190. addi.d I, I, -1
  191. ST a1, Y, 0 * SIZE
  192. ST a2, Y, 1 * SIZE
  193. add.d Y, Y, INCY
  194. blt $r0, I, .L26
  195. .align 3
  196. .L999:
  197. move $r4, $r17
  198. fmov.d $f0, $f22
  199. jirl $r0, $r1, 0x0
  200. EPILOGUE