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.

daxpy_thunderx2t99.S 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*******************************************************************************
  2. Copyright (c) 2017, 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 x0 /* vector length */
  30. #define X x3 /* X vector address */
  31. #define INC_X x4 /* X stride */
  32. #define Y x5 /* Y vector address */
  33. #define INC_Y x6 /* Y stride */
  34. #define I x1 /* loop variable */
  35. /*******************************************************************************
  36. * Macro definitions
  37. *******************************************************************************/
  38. #define DA d0 /* scale input value */
  39. #define TMPX d1
  40. #define TMPVX {v1.d}[0]
  41. #define TMPY d2
  42. #define TMPVY {v2.d}[0]
  43. #define SZ 8
  44. /******************************************************************************/
  45. .macro KERNEL_F1
  46. ldr TMPX, [X], #SZ
  47. ldr TMPY, [Y]
  48. fmadd TMPY, TMPX, DA, TMPY
  49. str TMPY, [Y], #SZ
  50. .endm
  51. .macro KERNEL_F16
  52. ldp q4, q5, [X]
  53. ldp q16, q17, [Y]
  54. ldp q6, q7, [X, #32]
  55. ldp q18, q19, [Y, #32]
  56. fmla v16.2d, v4.2d, v0.d[0]
  57. fmla v17.2d, v5.2d, v0.d[0]
  58. PRFM PLDL1KEEP, [X, #896]
  59. PRFM PLDL1KEEP, [Y, #896]
  60. stp q16, q17, [Y]
  61. ldp q20, q21, [X, #64]
  62. ldp q24, q25, [Y, #64]
  63. fmla v18.2d, v6.2d, v0.d[0]
  64. fmla v19.2d, v7.2d, v0.d[0]
  65. PRFM PLDL1KEEP, [X, #896+64]
  66. PRFM PLDL1KEEP, [Y, #896+64]
  67. stp q18, q19, [Y, #32]
  68. ldp q22, q23, [X, #96]
  69. ldp q26, q27, [Y, #96]
  70. fmla v24.2d, v20.2d, v0.d[0]
  71. fmla v25.2d, v21.2d, v0.d[0]
  72. stp q24, q25, [Y, #64]
  73. fmla v26.2d, v22.2d, v0.d[0]
  74. fmla v27.2d, v23.2d, v0.d[0]
  75. stp q26, q27, [Y, #96]
  76. add Y, Y, #128
  77. add X, X, #128
  78. .endm
  79. .macro KERNEL_F32
  80. KERNEL_F16
  81. KERNEL_F16
  82. .endm
  83. .macro INIT_S
  84. lsl INC_X, INC_X, #3
  85. lsl INC_Y, INC_Y, #3
  86. .endm
  87. .macro KERNEL_S1
  88. ld1 TMPVX, [X], INC_X
  89. ldr TMPY, [Y]
  90. fmadd TMPY, TMPX, DA, TMPY
  91. st1 TMPVY, [Y], INC_Y
  92. .endm
  93. /*******************************************************************************
  94. * End of macro definitions
  95. *******************************************************************************/
  96. PROLOGUE
  97. cmp N, xzr
  98. ble .Ldaxpy_kernel_L999
  99. fcmp DA, #0.0
  100. beq .Ldaxpy_kernel_L999
  101. cmp INC_X, #1
  102. bne .Ldaxpy_kernel_S_BEGIN
  103. cmp INC_Y, #1
  104. bne .Ldaxpy_kernel_S_BEGIN
  105. .Ldaxpy_kernel_F_BEGIN:
  106. asr I, N, #5
  107. cmp I, xzr
  108. beq .Ldaxpy_kernel_F1
  109. .align 5
  110. .Ldaxpy_kernel_F32:
  111. KERNEL_F32
  112. subs I, I, #1
  113. bne .Ldaxpy_kernel_F32
  114. .Ldaxpy_kernel_F1:
  115. ands I, N, #31
  116. ble .Ldaxpy_kernel_L999
  117. .Ldaxpy_kernel_F10:
  118. KERNEL_F1
  119. subs I, I, #1
  120. bne .Ldaxpy_kernel_F10
  121. b .Ldaxpy_kernel_L999
  122. .Ldaxpy_kernel_S_BEGIN:
  123. INIT_S
  124. asr I, N, #2
  125. cmp I, xzr
  126. ble .Ldaxpy_kernel_S1
  127. .Ldaxpy_kernel_S4:
  128. KERNEL_S1
  129. KERNEL_S1
  130. KERNEL_S1
  131. KERNEL_S1
  132. subs I, I, #1
  133. bne .Ldaxpy_kernel_S4
  134. .Ldaxpy_kernel_S1:
  135. ands I, N, #3
  136. ble .Ldaxpy_kernel_L999
  137. .Ldaxpy_kernel_S10:
  138. KERNEL_S1
  139. subs I, I, #1
  140. bne .Ldaxpy_kernel_S10
  141. .Ldaxpy_kernel_L999:
  142. mov w0, wzr
  143. ret