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.

scal.S 7.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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 $r7
  31. #define INCX $r8
  32. #define I $r17
  33. #define TEMP $r18
  34. #define XX $r5
  35. #define ALPHA $f0
  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. #define t1 $f14
  45. #define t2 $f15
  46. #define t3 $f16
  47. #define t4 $f17
  48. PROLOGUE
  49. li.d TEMP, SIZE
  50. MTC a1, $r0
  51. slli.d INCX, INCX, BASE_SHIFT
  52. bge $r0, N, .L999
  53. CMPEQ $fcc0, ALPHA, a1
  54. bceqz $fcc0, .L50
  55. srai.d I, N, 3
  56. bne INCX, TEMP, .L20
  57. bge $r0, I, .L15
  58. .align 3
  59. .L12:
  60. ST a1, X, 0 * SIZE
  61. ST a1, X, 1 * SIZE
  62. ST a1, X, 2 * SIZE
  63. ST a1, X, 3 * SIZE
  64. ST a1, X, 4 * SIZE
  65. ST a1, X, 5 * SIZE
  66. ST a1, X, 6 * SIZE
  67. ST a1, X, 7 * SIZE
  68. addi.w I, I, -1
  69. addi.d X, X, 8 * SIZE
  70. blt $r0, I, .L12
  71. .align 3
  72. .L15:
  73. andi I, N, 7
  74. bge $r0, I, .L999
  75. .align 3
  76. .L16:
  77. ST a1, X, 0 * SIZE
  78. addi.d I, I, -1
  79. addi.d X, X, SIZE
  80. blt $r0, I, .L16
  81. move $r4, $r17
  82. fmov.d $f0, $f22
  83. jirl $r0, $r1, 0x0
  84. .align 3
  85. .L20:
  86. srai.d I, N, 3
  87. bge $r0, I, .L25
  88. .align 3
  89. .L22:
  90. ST a1, X, 0 * SIZE
  91. add.d X, X, INCX
  92. ST a1, X, 0 * SIZE
  93. add.d X, X, INCX
  94. ST a1, X, 0 * SIZE
  95. add.d X, X, INCX
  96. ST a1, X, 0 * SIZE
  97. add.d X, X, INCX
  98. ST a1, X, 0 * SIZE
  99. add.d X, X, INCX
  100. ST a1, X, 0 * SIZE
  101. add.d X, X, INCX
  102. ST a1, X, 0 * SIZE
  103. add.d X, X, INCX
  104. ST a1, X, 0 * SIZE
  105. addi.d I, I, -1
  106. add.d X, X, INCX
  107. blt $r0, I, .L22
  108. .align 3
  109. .L25:
  110. andi I, N, 7
  111. bge $r0, I, .L999
  112. .align 3
  113. .L26:
  114. addi.d I, I, -1
  115. ST a1, X, 0 * SIZE
  116. add.d X, X, INCX
  117. blt $r0, I, .L26
  118. move $r4, $r17
  119. fmov.d $f0, $f22
  120. jirl $r0, $r1, 0x0
  121. .align 3
  122. .L50:
  123. srai.d I, N, 3
  124. bne INCX, TEMP, .L60
  125. addi.d I, I, -1
  126. blt I, $r0, .L55
  127. LD a1, X, 0 * SIZE
  128. LD a2, X, 1 * SIZE
  129. LD a3, X, 2 * SIZE
  130. LD a4, X, 3 * SIZE
  131. LD a5, X, 4 * SIZE
  132. LD a6, X, 5 * SIZE
  133. LD a7, X, 6 * SIZE
  134. LD a8, X, 7 * SIZE
  135. bge $r0, I, .L53
  136. .align 3
  137. .L52:
  138. MUL t1, ALPHA, a1
  139. LD a1, X, 8 * SIZE
  140. MUL t2, ALPHA, a2
  141. LD a2, X, 9 * SIZE
  142. MUL t3, ALPHA, a3
  143. LD a3, X, 10 * SIZE
  144. MUL t4, ALPHA, a4
  145. LD a4, X, 11 * SIZE
  146. ST t1, X, 0 * SIZE
  147. MUL t1, ALPHA, a5
  148. LD a5, X, 12 * SIZE
  149. ST t2, X, 1 * SIZE
  150. MUL t2, ALPHA, a6
  151. LD a6, X, 13 * SIZE
  152. ST t3, X, 2 * SIZE
  153. MUL t3, ALPHA, a7
  154. LD a7, X, 14 * SIZE
  155. ST t4, X, 3 * SIZE
  156. MUL t4, ALPHA, a8
  157. LD a8, X, 15 * SIZE
  158. addi.d I, I, -1
  159. ST t1, X, 4 * SIZE
  160. ST t2, X, 5 * SIZE
  161. ST t3, X, 6 * SIZE
  162. ST t4, X, 7 * SIZE
  163. addi.d X, X, 8 * SIZE
  164. blt $r0, I, .L52
  165. .align 3
  166. .L53:
  167. MUL t1, ALPHA, a1
  168. MUL t2, ALPHA, a2
  169. MUL t3, ALPHA, a3
  170. MUL t4, ALPHA, a4
  171. ST t1, X, 0 * SIZE
  172. MUL t1, ALPHA, a5
  173. ST t2, X, 1 * SIZE
  174. MUL t2, ALPHA, a6
  175. ST t3, X, 2 * SIZE
  176. MUL t3, ALPHA, a7
  177. ST t4, X, 3 * SIZE
  178. MUL t4, ALPHA, a8
  179. ST t1, X, 4 * SIZE
  180. ST t2, X, 5 * SIZE
  181. ST t3, X, 6 * SIZE
  182. ST t4, X, 7 * SIZE
  183. addi.d X, X, 8 * SIZE
  184. .align 3
  185. .L55:
  186. andi I, N, 7
  187. bge $r0, I, .L999
  188. .align 3
  189. .L56:
  190. LD a1, X, 0 * SIZE
  191. MUL t1, ALPHA, a1
  192. addi.d X, X, SIZE
  193. addi.d I, I, -1
  194. ST t1, X, -1 * SIZE
  195. blt $r0, I, .L56
  196. move $r4, $r17
  197. fmov.d $f0, $f22
  198. jirl $r0, $r1, 0x0
  199. .align 3
  200. .L60:
  201. srai.d I, N, 3
  202. move XX, X
  203. addi.d I, I, -1
  204. blt I, $r0, .L65
  205. LD a1, X, 0 * SIZE
  206. add.d X, X, INCX
  207. LD a2, X, 0 * SIZE
  208. add.d X, X, INCX
  209. LD a3, X, 0 * SIZE
  210. add.d X, X, INCX
  211. LD a4, X, 0 * SIZE
  212. add.d X, X, INCX
  213. LD a5, X, 0 * SIZE
  214. add.d X, X, INCX
  215. LD a6, X, 0 * SIZE
  216. add.d X, X, INCX
  217. LD a7, X, 0 * SIZE
  218. add.d X, X, INCX
  219. LD a8, X, 0 * SIZE
  220. add.d X, X, INCX
  221. bge $r0, I, .L63
  222. .align 3
  223. .L62:
  224. MUL t1, ALPHA, a1
  225. LD a1, X, 0 * SIZE
  226. add.d X, X, INCX
  227. MUL t2, ALPHA, a2
  228. LD a2, X, 0 * SIZE
  229. add.d X, X, INCX
  230. MUL t3, ALPHA, a3
  231. LD a3, X, 0 * SIZE
  232. add.d X, X, INCX
  233. MUL t4, ALPHA, a4
  234. LD a4, X, 0 * SIZE
  235. add.d X, X, INCX
  236. ST t1, XX, 0 * SIZE
  237. add.d XX, XX, INCX
  238. ST t2, XX, 0 * SIZE
  239. add.d XX, XX, INCX
  240. ST t3, XX, 0 * SIZE
  241. add.d XX, XX, INCX
  242. ST t4, XX, 0 * SIZE
  243. add.d XX, XX, INCX
  244. MUL t1, ALPHA, a5
  245. LD a5, X, 0 * SIZE
  246. add.d X, X, INCX
  247. MUL t2, ALPHA, a6
  248. LD a6, X, 0 * SIZE
  249. add.d X, X, INCX
  250. MUL t3, ALPHA, a7
  251. LD a7, X, 0 * SIZE
  252. add.d X, X, INCX
  253. MUL t4, ALPHA, a8
  254. LD a8, X, 0 * SIZE
  255. add.d X, X, INCX
  256. ST t1, XX, 0 * SIZE
  257. add.d XX, XX, INCX
  258. ST t2, XX, 0 * SIZE
  259. add.d XX, XX, INCX
  260. ST t3, XX, 0 * SIZE
  261. add.d XX, XX, INCX
  262. ST t4, XX, 0 * SIZE
  263. addi.d I, I, -1
  264. add.d XX, XX, INCX
  265. blt $r0, I, .L62
  266. .align 3
  267. .L63:
  268. MUL t1, ALPHA, a1
  269. MUL t2, ALPHA, a2
  270. MUL t3, ALPHA, a3
  271. MUL t4, ALPHA, a4
  272. ST t1, XX, 0 * SIZE
  273. add.d XX, XX, INCX
  274. ST t2, XX, 0 * SIZE
  275. add.d XX, XX, INCX
  276. ST t3, XX, 0 * SIZE
  277. add.d XX, XX, INCX
  278. ST t4, XX, 0 * SIZE
  279. add.d XX, XX, INCX
  280. MUL t1, ALPHA, a5
  281. MUL t2, ALPHA, a6
  282. MUL t3, ALPHA, a7
  283. MUL t4, ALPHA, a8
  284. ST t1, XX, 0 * SIZE
  285. add.d XX, XX, INCX
  286. ST t2, XX, 0 * SIZE
  287. add.d XX, XX, INCX
  288. ST t3, XX, 0 * SIZE
  289. add.d XX, XX, INCX
  290. ST t4, XX, 0 * SIZE
  291. add.d XX, XX, INCX
  292. .align 3
  293. .L65:
  294. andi I, N, 7
  295. bge $r0, I, .L999
  296. .align 3
  297. .L66:
  298. LD a1, X, 0 * SIZE
  299. MUL t1, ALPHA, a1
  300. addi.d I, I, -1
  301. ST t1, X, 0 * SIZE
  302. add.d X, X, INCX
  303. blt $r0, I, .L66
  304. .align 3
  305. .L999:
  306. move $r4, $r17
  307. fmov.d $f0, $f22
  308. jirl $r0, $r1, 0x0
  309. EPILOGUE