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.

cnrm2.S 4.3 kB

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