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_ncopy_2_vfp.S 4.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /***************************************************************************
  2. Copyright (c) 2013, 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. /**************************************************************************************
  28. * 2013/11/24 Saar
  29. * BLASTEST : OK
  30. * CTEST : OK
  31. * TEST : OK
  32. *
  33. **************************************************************************************/
  34. #define ASSEMBLER
  35. #include "common.h"
  36. #define STACKSIZE 256
  37. #define OLD_M r0
  38. #define OLD_N r1
  39. #define OLD_A r2
  40. #define OLD_LDA r3
  41. #define B [fp, #4 ]
  42. #define M r0
  43. #define N r1
  44. #define A r2
  45. #define BO r5
  46. #define AO1 r6
  47. #define AO2 r7
  48. #define LDA r8
  49. #define I r3
  50. #define J r12
  51. #define A_PRE 256
  52. /**************************************************************************************
  53. * Macro definitions
  54. **************************************************************************************/
  55. .macro COPY2x2
  56. fldd d0 , [ AO1, #0 ]
  57. fldd d2 , [ AO1, #8 ]
  58. fldd d1 , [ AO2, #0 ]
  59. fldd d3 , [ AO2, #8 ]
  60. add AO1, AO1, #16
  61. vstmia.f64 BO!, { d0 - d3 }
  62. add AO2, AO2, #16
  63. .endm
  64. .macro COPY1x2
  65. fldd d0 , [ AO1, #0 ]
  66. fldd d1 , [ AO2, #0 ]
  67. add AO1, AO1, #8
  68. vstmia.f64 BO!, { d0 - d1 }
  69. add AO2, AO2, #8
  70. .endm
  71. .macro COPY2x1
  72. fldd d0 , [ AO1, #0 ]
  73. fldd d1 , [ AO1, #8 ]
  74. vstmia.f64 BO!, { d0 - d1 }
  75. add AO1, AO1, #16
  76. .endm
  77. .macro COPY1x1
  78. fldd d0 , [ AO1, #0 ]
  79. vstmia.f64 BO!, { d0 }
  80. add AO1, AO1, #8
  81. .endm
  82. /**************************************************************************************
  83. * End of macro definitions
  84. **************************************************************************************/
  85. PROLOGUE
  86. .align 5
  87. push {r4 - r9, fp}
  88. add fp, sp, #24
  89. lsl LDA, OLD_LDA, #3 // lda = lda * 8
  90. ldr BO, B
  91. /*********************************************************************************************/
  92. dgemm_ncopy_L2_BEGIN:
  93. asrs J, N, #1 // J = N / 2
  94. ble dgemm_ncopy_L1_BEGIN
  95. dgemm_ncopy_L2_M2_BEGIN:
  96. mov AO1, A // AO1 = A
  97. add AO2, AO1, LDA
  98. add A , AO2, LDA // A = A + 2 * LDA
  99. asrs I, M, #1 // I = M / 2
  100. ble dgemm_ncopy_L2_M2_40
  101. dgemm_ncopy_L2_M2_20:
  102. COPY2x2
  103. subs I , I , #1
  104. bne dgemm_ncopy_L2_M2_20
  105. dgemm_ncopy_L2_M2_40:
  106. ands I, M , #1
  107. ble dgemm_ncopy_L2_M2_END
  108. dgemm_ncopy_L2_M2_60:
  109. COPY1x2
  110. subs I , I , #1
  111. bne dgemm_ncopy_L2_M2_60
  112. dgemm_ncopy_L2_M2_END:
  113. subs J , J, #1 // j--
  114. bne dgemm_ncopy_L2_M2_BEGIN
  115. /*********************************************************************************************/
  116. dgemm_ncopy_L1_BEGIN:
  117. tst N, #1
  118. ble dgemm_ncopy_L999
  119. dgemm_ncopy_L1_M2_BEGIN:
  120. mov AO1, A // AO1 = A
  121. add A , AO1, LDA // A = A + 1 * LDA
  122. asrs I, M, #1 // I = M / 2
  123. ble dgemm_ncopy_L1_M2_40
  124. dgemm_ncopy_L1_M2_20:
  125. COPY2x1
  126. subs I , I , #1
  127. bne dgemm_ncopy_L1_M2_20
  128. dgemm_ncopy_L1_M2_40:
  129. ands I, M , #1
  130. ble dgemm_ncopy_L1_M2_END
  131. dgemm_ncopy_L1_M2_60:
  132. COPY1x1
  133. subs I , I , #1
  134. bne dgemm_ncopy_L1_M2_60
  135. dgemm_ncopy_L1_M2_END:
  136. dgemm_ncopy_L999:
  137. movs r0, #0 // set return value
  138. sub sp, fp, #24
  139. pop {r4 - r9, fp}
  140. bx lr
  141. EPILOGUE