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.

gemm_ncopy_2_sse.S 5.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #define ASSEMBLER
  39. #include "common.h"
  40. #define RPREFETCHSIZE 12
  41. #define WPREFETCHSIZE (RPREFETCHSIZE * 2)
  42. #define PREFETCH prefetcht0
  43. #define PREFETCHW prefetcht2
  44. #define STACK 16
  45. #define ARGS 0
  46. #define M 4 + STACK + ARGS(%esp)
  47. #define N 8 + STACK + ARGS(%esp)
  48. #define ARG_A 12 + STACK + ARGS(%esp)
  49. #define ARG_LDA 16 + STACK + ARGS(%esp)
  50. #define ARG_B 20 + STACK + ARGS(%esp)
  51. #define A %eax
  52. #define B %ebx
  53. #define LDA %ebp
  54. #define A1 %ecx
  55. #define A2 %edx
  56. #define I %esi
  57. #define J %edi
  58. PROLOGUE
  59. pushl %ebp
  60. pushl %edi
  61. pushl %esi
  62. pushl %ebx
  63. PROFCODE
  64. movl ARG_A, A
  65. movl ARG_B, B
  66. movl ARG_LDA, LDA
  67. sall $BASE_SHIFT, LDA
  68. movl N, J
  69. sarl $1, J
  70. je .L20
  71. ALIGN_3
  72. .L10:
  73. movl A, A1
  74. leal (A, LDA, 1), A2
  75. leal (A, LDA, 2), A
  76. movl M, I
  77. sarl $2, I
  78. je .L15
  79. ALIGN_3
  80. .L12:
  81. PREFETCH RPREFETCHSIZE * SIZE(A1)
  82. movsd 0 * SIZE(A1) , %xmm0
  83. movhps 0 * SIZE(A2) , %xmm0
  84. movsd 1 * SIZE(A1) , %xmm1
  85. movhps 1 * SIZE(A2) , %xmm1
  86. PREFETCH RPREFETCHSIZE * SIZE(A2)
  87. movsd 2 * SIZE(A1) , %xmm2
  88. movhps 2 * SIZE(A2) , %xmm2
  89. movsd 3 * SIZE(A1) , %xmm3
  90. movhps 3 * SIZE(A2) , %xmm3
  91. PREFETCHW (RPREFETCHSIZE + 0) * SIZE(B)
  92. movaps %xmm0, 0 * SIZE(B)
  93. movaps %xmm1, 2 * SIZE(B)
  94. movaps %xmm2, 4 * SIZE(B)
  95. movaps %xmm3, 6 * SIZE(B)
  96. addl $ 4 * SIZE, A1
  97. addl $ 4 * SIZE, A2
  98. subl $-8 * SIZE, B
  99. decl I
  100. jne .L12
  101. ALIGN_3
  102. .L15:
  103. testl $2, M
  104. jle .L16
  105. movsd 0 * SIZE(A1) , %xmm0
  106. movhps 0 * SIZE(A2) , %xmm0
  107. movsd 1 * SIZE(A1) , %xmm1
  108. movhps 1 * SIZE(A2) , %xmm1
  109. movaps %xmm0, 0 * SIZE(B)
  110. movaps %xmm1, 2 * SIZE(B)
  111. addl $ 2 * SIZE, A1
  112. addl $ 2 * SIZE, A2
  113. subl $-4 * SIZE, B
  114. ALIGN_4
  115. .L16:
  116. testl $1, M
  117. jle .L19
  118. movsd 0 * SIZE(A1) , %xmm0
  119. movhps 0 * SIZE(A2) , %xmm0
  120. movaps %xmm0, 0 * SIZE(B)
  121. subl $-2 * SIZE, B
  122. ALIGN_4
  123. .L19:
  124. decl J
  125. jne .L10
  126. ALIGN_3
  127. .L20:
  128. testl $1, N
  129. jle .L999
  130. movl A, A1
  131. movl M, I
  132. sarl $2, I
  133. je .L25
  134. ALIGN_3
  135. .L22:
  136. PREFETCH RPREFETCHSIZE * SIZE(A1)
  137. movsd 0 * SIZE(A1), %xmm0
  138. movhps 1 * SIZE(A1), %xmm0
  139. movsd 2 * SIZE(A1), %xmm1
  140. movhps 3 * SIZE(A1), %xmm1
  141. PREFETCHW (RPREFETCHSIZE + 0) * SIZE(B)
  142. movaps %xmm0, 0 * SIZE(B)
  143. movaps %xmm1, 2 * SIZE(B)
  144. addl $ 4 * SIZE, A1
  145. subl $-4 * SIZE, B
  146. decl I
  147. jne .L22
  148. ALIGN_3
  149. .L25:
  150. testl $2, M
  151. jle .L26
  152. movsd 0 * SIZE(A1), %xmm0
  153. movhps 1 * SIZE(A1), %xmm0
  154. movaps %xmm0, 0 * SIZE(B)
  155. addl $ 2 * SIZE, A1
  156. subl $-2 * SIZE, B
  157. ALIGN_4
  158. .L26:
  159. testl $1, M
  160. jle .L999
  161. movsd 0 * SIZE(A1), %xmm0
  162. movsd %xmm0, 0 * SIZE(B)
  163. ALIGN_4
  164. .L999:
  165. popl %ebx
  166. popl %esi
  167. popl %edi
  168. popl %ebp
  169. ret
  170. EPILOGUE