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.

zgemm_tcopy_2_vfp.S 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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/07 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. /******************************************************
  42. * [fp, #-128] - [fp, #-64] is reserved
  43. * for store and restore of floating point
  44. * registers
  45. *******************************************************/
  46. #define B [fp, #4 ]
  47. #define A [fp, #-248 ]
  48. #define M r0
  49. #define N r1
  50. #define M4 r2
  51. #define LDA r5
  52. #define AO1 r6
  53. #define BO1 r7
  54. #define BO2 r8
  55. #define I r4
  56. #define J r12
  57. #define A_PRE 256
  58. /**************************************************************************************
  59. * Macro definitions
  60. **************************************************************************************/
  61. .macro COPY2x2
  62. pld [ AO1, #A_PRE ]
  63. vldmia.f64 AO1, { d0 - d3 }
  64. add r3, AO1, LDA
  65. pld [ r3, #A_PRE ]
  66. vldmia.f64 r3, { d4 - d7 }
  67. vstmia.f64 BO1, { d0 - d7 }
  68. add AO1, AO1, #32
  69. add BO1, BO1, M4
  70. .endm
  71. .macro COPY1x2
  72. vldmia.f64 AO1, { d0 -d1 }
  73. add r3, AO1, LDA
  74. vldmia.f64 r3, { d2 - d3 }
  75. vstmia.f64 BO2, { d0 - d3 }
  76. add AO1, AO1, #16
  77. add BO2, BO2, #32
  78. .endm
  79. /*************************************************************************************************************************/
  80. .macro COPY2x1
  81. vldmia.f64 AO1, { d0 - d3 }
  82. vstmia.f64 BO1, { d0 - d3 }
  83. add AO1, AO1, #32
  84. add BO1, BO1, M4
  85. .endm
  86. .macro COPY1x1
  87. vldmia.f64 AO1, { d0 - d1 }
  88. vstmia.f64 BO2, { d0 - d1 }
  89. add AO1, AO1, #16
  90. add BO2, BO2, #16
  91. .endm
  92. /**************************************************************************************
  93. * End of macro definitions
  94. **************************************************************************************/
  95. PROLOGUE
  96. .align 5
  97. push {r4 - r9, fp}
  98. add fp, sp, #24
  99. sub sp, sp, #STACKSIZE // reserve stack
  100. str OLD_A, A // store A
  101. lsl LDA, OLD_LDA, #4 // lda = lda * SIZE * 2
  102. sub r4, fp, #128
  103. vstm r4, { d8 - d15} // store floating point registers
  104. lsl r4 , M, #4 // M * SIZE * 2
  105. ldr r3, B
  106. and BO2 , N , #-2
  107. mul BO2, BO2, r4
  108. add BO2 , BO2, r3
  109. lsl M4, M, #5 // M4 = M * 2 * SIZE * 2
  110. zgemm_tcopy_L2_BEGIN:
  111. asrs J, M, #1 // J = N / 2
  112. ble zgemm_tcopy_L1_BEGIN
  113. zgemm_tcopy_L2_M2_BEGIN:
  114. ldr AO1, A // AO1 = A
  115. lsl r3, LDA, #1 // r3 = 2 * LDA
  116. add r3, r3 , AO1 // A = A + 2 * LDA
  117. str r3, A // store A
  118. ldr BO1, B
  119. add r3, BO1, #64 // B = B + 4 * SIZE *2
  120. str r3, B
  121. asrs I, N, #1 // I = M / 2
  122. ble zgemm_tcopy_L2_M2_60
  123. zgemm_tcopy_L2_M2_40:
  124. COPY2x2
  125. subs I, I, #1
  126. bne zgemm_tcopy_L2_M2_40
  127. zgemm_tcopy_L2_M2_60:
  128. tst N , #1
  129. ble zgemm_tcopy_L2_M2_END
  130. COPY1x2
  131. zgemm_tcopy_L2_M2_END:
  132. subs J , J, #1 // j--
  133. bne zgemm_tcopy_L2_M2_BEGIN
  134. /*********************************************************************************************/
  135. zgemm_tcopy_L1_BEGIN:
  136. tst M, #1
  137. ble zgemm_tcopy_L999
  138. zgemm_tcopy_L1_M2_BEGIN:
  139. ldr AO1, A // AO1 = A
  140. add r3, LDA , AO1 // A = A + 1 * LDA
  141. str r3, A // store A
  142. ldr BO1, B
  143. add r3, BO1, #32 // B = B + 2 * SIZE *2
  144. str r3, B
  145. asrs I, N, #1 // I = M / 2
  146. ble zgemm_tcopy_L1_M2_60
  147. zgemm_tcopy_L1_M2_40:
  148. COPY2x1
  149. subs I, I, #1
  150. bne zgemm_tcopy_L1_M2_40
  151. zgemm_tcopy_L1_M2_60:
  152. tst N , #1
  153. ble zgemm_tcopy_L1_M2_END
  154. COPY1x1
  155. zgemm_tcopy_L1_M2_END:
  156. zgemm_tcopy_L999:
  157. sub r3, fp, #128
  158. vldm r3, { d8 - d15} // restore floating point registers
  159. mov r0, #0 // set return value
  160. sub sp, fp, #24
  161. pop {r4 - r9, fp}
  162. bx lr
  163. EPILOGUE