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.

zcopy_vfp.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 N r0
  38. #define X r1
  39. #define INC_X r2
  40. #define OLD_Y r3
  41. /******************************************************
  42. * [fp, #-128] - [fp, #-64] is reserved
  43. * for store and restore of floating point
  44. * registers
  45. *******************************************************/
  46. #define OLD_INC_Y [fp, #4 ]
  47. #define I r5
  48. #define Y r6
  49. #define INC_Y r7
  50. #define X_PRE 256
  51. /**************************************************************************************
  52. * Macro definitions
  53. **************************************************************************************/
  54. .macro COPY_F4
  55. pld [ X, #X_PRE ]
  56. pld [ X, #X_PRE+32 ]
  57. vldmia.f64 X!, { d0 - d7 }
  58. vstmia.f64 Y!, { d0 - d7 }
  59. .endm
  60. .macro COPY_F1
  61. vldmia.f64 X!, { d0 - d1 }
  62. vstmia.f64 Y!, { d0 - d1 }
  63. .endm
  64. /*************************************************************************************************************************/
  65. .macro COPY_S4
  66. nop
  67. vldmia.f64 X, { d0 - d1 }
  68. vstmia.f64 Y, { d0 - d1 }
  69. add X, X, INC_X
  70. add Y, Y, INC_Y
  71. vldmia.f64 X, { d2 - d3 }
  72. vstmia.f64 Y, { d2 - d3 }
  73. add X, X, INC_X
  74. add Y, Y, INC_Y
  75. vldmia.f64 X, { d0 - d1 }
  76. vstmia.f64 Y, { d0 - d1 }
  77. add X, X, INC_X
  78. add Y, Y, INC_Y
  79. vldmia.f64 X, { d2 - d3 }
  80. vstmia.f64 Y, { d2 - d3 }
  81. add X, X, INC_X
  82. add Y, Y, INC_Y
  83. .endm
  84. .macro COPY_S1
  85. vldmia.f64 X, { d0 - d1 }
  86. vstmia.f64 Y, { d0 - d1 }
  87. add X, X, INC_X
  88. add Y, Y, INC_Y
  89. .endm
  90. /**************************************************************************************
  91. * End of macro definitions
  92. **************************************************************************************/
  93. PROLOGUE
  94. .align 5
  95. push {r4 - r9, fp}
  96. add fp, sp, #24
  97. sub sp, sp, #STACKSIZE // reserve stack
  98. sub r4, fp, #128
  99. vstm r4, { d8 - d15} // store floating point registers
  100. mov Y, OLD_Y
  101. ldr INC_Y, OLD_INC_Y
  102. cmp N, #0
  103. ble zcopy_kernel_L999
  104. cmp INC_X, #0
  105. beq zcopy_kernel_L999
  106. cmp INC_Y, #0
  107. beq zcopy_kernel_L999
  108. cmp INC_X, #1
  109. bne zcopy_kernel_S_BEGIN
  110. cmp INC_Y, #1
  111. bne zcopy_kernel_S_BEGIN
  112. zcopy_kernel_F_BEGIN:
  113. asrs I, N, #2 // I = N / 4
  114. ble zcopy_kernel_F1
  115. zcopy_kernel_F4:
  116. COPY_F4
  117. subs I, I, #1
  118. bne zcopy_kernel_F4
  119. zcopy_kernel_F1:
  120. ands I, N, #3
  121. ble zcopy_kernel_L999
  122. zcopy_kernel_F10:
  123. COPY_F1
  124. subs I, I, #1
  125. bne zcopy_kernel_F10
  126. b zcopy_kernel_L999
  127. zcopy_kernel_S_BEGIN:
  128. lsl INC_X, INC_X, #4 // INC_X * SIZE * 2
  129. lsl INC_Y, INC_Y, #4 // INC_Y * SIZE * 2
  130. asrs I, N, #2 // I = N / 4
  131. ble zcopy_kernel_S1
  132. zcopy_kernel_S4:
  133. COPY_S4
  134. subs I, I, #1
  135. bne zcopy_kernel_S4
  136. zcopy_kernel_S1:
  137. ands I, N, #3
  138. ble zcopy_kernel_L999
  139. zcopy_kernel_S10:
  140. COPY_S1
  141. subs I, I, #1
  142. bne zcopy_kernel_S10
  143. zcopy_kernel_L999:
  144. sub r3, fp, #128
  145. vldm r3, { d8 - d15} // restore floating point registers
  146. mov r0, #0 // set return value
  147. sub sp, fp, #24
  148. pop {r4 - r9, fp}
  149. bx lr
  150. EPILOGUE