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.S 4.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 STACK 16
  41. #define ARGS 8
  42. #define J 0 + STACK(%esp)
  43. #define BOFFSET2 4 + STACK(%esp)
  44. #define STACK_M 4 + STACK + ARGS(%esp)
  45. #define STACK_N 8 + STACK + ARGS(%esp)
  46. #define STACK_A 12 + STACK + ARGS(%esp)
  47. #define STACK_LDA 16 + STACK + ARGS(%esp)
  48. #define STACK_B 20 + STACK + ARGS(%esp)
  49. PROLOGUE
  50. subl $ARGS, %esp
  51. pushl %ebp
  52. pushl %edi
  53. pushl %esi
  54. pushl %ebx
  55. PROFCODE
  56. #define A %ebp
  57. #define A1 %edx
  58. #define LDA %ecx
  59. #define B %edi
  60. #define I %ebx
  61. #define B1 %eax
  62. #define M4 %esi
  63. EMMS
  64. movl STACK_A, A
  65. movl STACK_B, B
  66. movl STACK_M, %ebx
  67. movl STACK_N, %eax
  68. movl STACK_LDA, LDA
  69. sall $ZBASE_SHIFT, LDA
  70. andl $-2, %eax
  71. addl %eax, %eax
  72. imull %ebx, %eax # m * ( n & ~1)
  73. leal (B, %eax, SIZE), %eax # boffset2 = b + m * (n & ~1)
  74. movl %eax, BOFFSET2
  75. movl STACK_M, M4
  76. sall $ZBASE_SHIFT + 1, M4
  77. testl %ebx, %ebx # if !(m & 1) goto L28
  78. movl %ebx, J
  79. jle .L999
  80. ALIGN_4
  81. .L39:
  82. movl A, A1
  83. addl LDA, A
  84. movl B, B1
  85. addl $4 * SIZE, B
  86. movl STACK_N, I
  87. sarl $1, I
  88. jle .L32
  89. ALIGN_4
  90. .L36:
  91. #ifdef HAVE_MMX
  92. MMXLOAD 0 * SIZE(A1), %mm0
  93. MMXLOAD 1 * SIZE(A1), %mm1
  94. MMXLOAD 2 * SIZE(A1), %mm2
  95. MMXLOAD 3 * SIZE(A1), %mm3
  96. MMXSTORE %mm0, 0 * SIZE(B1)
  97. MMXSTORE %mm1, 1 * SIZE(B1)
  98. MMXSTORE %mm2, 2 * SIZE(B1)
  99. MMXSTORE %mm3, 3 * SIZE(B1)
  100. #else
  101. FLD 3 * SIZE(A1)
  102. FLD 2 * SIZE(A1)
  103. FLD 1 * SIZE(A1)
  104. FLD 0 * SIZE(A1)
  105. FST 0 * SIZE(B1)
  106. FST 1 * SIZE(B1)
  107. FST 2 * SIZE(B1)
  108. FST 3 * SIZE(B1)
  109. #endif
  110. addl $4 * SIZE, A1
  111. addl M4, B1
  112. decl I
  113. jne .L36
  114. ALIGN_4
  115. .L32:
  116. movl STACK_N, I
  117. andl $1, I
  118. jle .L99
  119. ALIGN_4
  120. movl BOFFSET2, B1
  121. #ifdef HAVE_MMX
  122. MMXLOAD 0 * SIZE(A1), %mm0
  123. MMXLOAD 1 * SIZE(A1), %mm1
  124. MMXSTORE %mm0, 0 * SIZE(B1)
  125. MMXSTORE %mm1, 1 * SIZE(B1)
  126. #else
  127. FLD 1 * SIZE(A1)
  128. FLD 0 * SIZE(A1)
  129. FST 0 * SIZE(B1)
  130. FST 1 * SIZE(B1)
  131. #endif
  132. addl $2 * SIZE, BOFFSET2
  133. ALIGN_4
  134. .L99:
  135. decl J
  136. jne .L39
  137. ALIGN_4
  138. .L999:
  139. EMMS
  140. popl %ebx
  141. popl %esi
  142. popl %edi
  143. popl %ebp
  144. addl $ARGS,%esp
  145. ret
  146. EPILOGUE