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.

dgemm_beta.S 4.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /***************************************************************************
  2. Copyright (c) 2016, 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 A00 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 M x0
  30. #define N x1
  31. #define BETA d0
  32. #define LDC x6
  33. #define C00 x7
  34. #define A01 x8
  35. #define A02 x9
  36. #define A03 x10
  37. #define A04 x11
  38. #define beta0 d11
  39. #define betaV0 v11.d[0]
  40. #define I x16
  41. #define size 128
  42. /**************************************************************************************
  43. * Macro definitions
  44. **************************************************************************************/
  45. .macro SAVE_REGS
  46. add sp, sp, #-(11 * 16)
  47. stp d8, d9, [sp, #(0 * 16)]
  48. stp d10, d11, [sp, #(1 * 16)]
  49. stp d12, d13, [sp, #(2 * 16)]
  50. stp d14, d15, [sp, #(3 * 16)]
  51. stp d16, d17, [sp, #(4 * 16)]
  52. stp x18, x19, [sp, #(5 * 16)]
  53. stp x20, x21, [sp, #(6 * 16)]
  54. stp x22, x23, [sp, #(7 * 16)]
  55. stp x24, x25, [sp, #(8 * 16)]
  56. stp x26, x27, [sp, #(9 * 16)]
  57. str x28, [sp, #(10 * 16)]
  58. .endm
  59. .macro RESTORE_REGS
  60. ldp d8, d9, [sp, #(0 * 16)]
  61. ldp d10, d11, [sp, #(1 * 16)]
  62. ldp d12, d13, [sp, #(2 * 16)]
  63. ldp d14, d15, [sp, #(3 * 16)]
  64. ldp d16, d17, [sp, #(4 * 16)]
  65. ldp x18, x19, [sp, #(5 * 16)]
  66. ldp x20, x21, [sp, #(6 * 16)]
  67. ldp x22, x23, [sp, #(7 * 16)]
  68. ldp x24, x25, [sp, #(8 * 16)]
  69. ldp x26, x27, [sp, #(9 * 16)]
  70. ldr x28, [sp, #(10 * 16)]
  71. add sp, sp, #(11*16)
  72. .endm
  73. /**************************************************************************************
  74. * End of macro definitions
  75. **************************************************************************************/
  76. PROLOGUE
  77. .align 5
  78. ldr LDC, [sp]
  79. SAVE_REGS
  80. .Lgemm_beta_BEGIN:
  81. fmov beta0, BETA
  82. cmp N, #0
  83. ble .Lgemm_beta_L999
  84. .Lgemm_beta_01:
  85. lsl LDC, LDC, #3
  86. .align 5
  87. .Lgemm_beta_02:
  88. mov A01, C00
  89. add C00, C00, LDC
  90. asr I, M, #4
  91. cmp I, #0
  92. ble .Lgemm_beta_04
  93. add A02, A01, #32
  94. add A03, A02, #32
  95. add A04, A03, #32
  96. .align 5
  97. .Lgemm_beta_03:
  98. ldp q0, q1, [A01]
  99. ldp q2, q3, [A02]
  100. ldp q4, q5, [A03]
  101. ldp q6, q7, [A04]
  102. fmul v0.2d, v0.2d, betaV0
  103. fmul v1.2d, v1.2d, betaV0
  104. fmul v2.2d, v2.2d, betaV0
  105. fmul v3.2d, v3.2d, betaV0
  106. fmul v4.2d, v4.2d, betaV0
  107. fmul v5.2d, v5.2d, betaV0
  108. fmul v6.2d, v6.2d, betaV0
  109. fmul v7.2d, v7.2d, betaV0
  110. st1 {v0.2d, v1.2d}, [A01]
  111. add A01, A01, size
  112. st1 {v2.2d, v3.2d}, [A02]
  113. add A02, A02, size
  114. st1 {v4.2d, v5.2d}, [A03]
  115. add A03, A03, size
  116. st1 {v6.2d, v7.2d}, [A04]
  117. add A04, A04, size
  118. subs I , I , #1
  119. bne .Lgemm_beta_03
  120. .align 5
  121. .Lgemm_beta_04:
  122. and I, M , #15 // M%16
  123. cmp I, #0
  124. ble .Lgemm_beta_06
  125. .align 5
  126. .Lgemm_beta_05:
  127. ldr d12, [A01]
  128. fmul d12, d12, beta0
  129. str d12, [A01]
  130. add A01, A01, #8
  131. subs I , I , #1
  132. bne .Lgemm_beta_05
  133. .align 5
  134. .Lgemm_beta_06:
  135. subs N , N, #1 // N--
  136. bne .Lgemm_beta_02
  137. .align 5
  138. .Lgemm_beta_L999:
  139. mov x0, #0
  140. RESTORE_REGS
  141. ret
  142. EPILOGUE