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_beta.S 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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 12
  41. #define ARGS 0
  42. #define M 4 + STACK + ARGS(%esp)
  43. #define N 8 + STACK + ARGS(%esp)
  44. #ifdef DOUBLE
  45. #define BETA_R 16 + STACK + ARGS(%esp)
  46. #define BETA_I 24 + STACK + ARGS(%esp)
  47. #define C 48 + STACK + ARGS(%esp)
  48. #define LDC 52 + STACK + ARGS(%esp)
  49. #else
  50. #define BETA_R 16 + STACK + ARGS(%esp)
  51. #define BETA_I 20 + STACK + ARGS(%esp)
  52. #define C 40 + STACK + ARGS(%esp)
  53. #define LDC 44 + STACK + ARGS(%esp)
  54. #endif
  55. PROLOGUE
  56. pushl %ebp
  57. pushl %edi
  58. pushl %esi
  59. PROFCODE
  60. movl M, %ebp
  61. movl N, %ecx
  62. movl LDC, %edx
  63. movl C, %edi
  64. FLD BETA_R
  65. FLD BETA_I
  66. testl %ebp, %ebp # if n <= 0 goto End
  67. jle .L83
  68. testl %ecx, %ecx # if m <= 0 goto End
  69. jle .L83
  70. fld %st(1)
  71. fabs
  72. fld %st(1)
  73. fabs
  74. faddp %st, %st(1)
  75. sall $ZBASE_SHIFT, %edx
  76. ftst
  77. fnstsw %ax
  78. andb $68, %ah
  79. #ifndef C_SUN
  80. ffreep %st(0)
  81. #else
  82. .byte 0xdf
  83. .byte 0xc0
  84. #endif
  85. je .L71
  86. ALIGN_2
  87. .L53:
  88. movl %edi, %esi # c_offset1 = c_offset
  89. addl %edx, %edi # c_offset += ldc
  90. movl %ebp, %eax
  91. sarl $2, %eax
  92. jle .L56
  93. ALIGN_2
  94. .L57:
  95. #if defined(HAS_PREFETCH) && defined(PENTIUM3)
  96. prefetchnta 16 * SIZE(%esi)
  97. prefetchnta 24 * SIZE(%esi)
  98. #endif
  99. FSTU 0 * SIZE(%esi) # c_offset1
  100. FSTU 1 * SIZE(%esi)
  101. FSTU 2 * SIZE(%esi)
  102. FSTU 3 * SIZE(%esi)
  103. FSTU 4 * SIZE(%esi)
  104. FSTU 5 * SIZE(%esi)
  105. FSTU 6 * SIZE(%esi)
  106. FSTU 7 * SIZE(%esi)
  107. addl $8 * SIZE, %esi # c_offset1 += 8
  108. decl %eax # i--
  109. jg .L57
  110. ALIGN_2
  111. .L56:
  112. movl %ebp, %eax
  113. andl $3, %eax
  114. jle .L62
  115. ALIGN_2
  116. .L63:
  117. FSTU 0 * SIZE(%esi)
  118. FSTU 1 * SIZE(%esi)
  119. addl $2 * SIZE,%esi
  120. decl %eax
  121. jg .L63
  122. ALIGN_2
  123. .L62:
  124. decl %ecx # j --
  125. jg .L53
  126. jmp .L83
  127. ALIGN_3
  128. .L71:
  129. movl %edi, %esi
  130. addl %edx, %edi # c_offset += ldc
  131. movl %ebp, %eax
  132. sarl $1, %eax
  133. jle .L84
  134. ALIGN_3
  135. .L85:
  136. #if defined(HAS_PREFETCH) && defined(PENTIUM3)
  137. prefetchnta 16 * SIZE(%esi)
  138. #endif
  139. fld %st(0)
  140. FMUL 0 * SIZE(%esi)
  141. fld %st(2)
  142. FMUL 1 * SIZE(%esi)
  143. faddp %st,%st(1)
  144. fld %st(2)
  145. FMUL 0 * SIZE(%esi)
  146. fld %st(2)
  147. FMUL 1 * SIZE(%esi)
  148. fsubrp %st,%st(1)
  149. FST 0 * SIZE(%esi)
  150. FST 1 * SIZE(%esi)
  151. fld %st(0)
  152. FMUL 2 * SIZE(%esi)
  153. fld %st(2)
  154. FMUL 3 * SIZE(%esi)
  155. faddp %st,%st(1)
  156. fld %st(2)
  157. FMUL 2 * SIZE(%esi)
  158. fld %st(2)
  159. FMUL 3 * SIZE(%esi)
  160. fsubrp %st,%st(1)
  161. FST 2 * SIZE(%esi)
  162. FST 3 * SIZE(%esi)
  163. addl $4 * SIZE, %esi
  164. decl %eax
  165. jg .L85
  166. ALIGN_3
  167. .L84:
  168. movl %ebp, %eax
  169. andl $1, %eax
  170. jle .L74
  171. ALIGN_3
  172. .L75:
  173. #if defined(HAS_PREFETCH) && defined(PENTIUM3)
  174. prefetchnta 16 * SIZE(%esi)
  175. #endif
  176. fld %st(0)
  177. FMUL 0 * SIZE(%esi)
  178. fld %st(2)
  179. FMUL 1 * SIZE(%esi)
  180. faddp %st,%st(1)
  181. fld %st(2)
  182. FMUL 0 * SIZE(%esi)
  183. fld %st(2)
  184. FMUL 1 * SIZE(%esi)
  185. fsubrp %st,%st(1)
  186. FST 0 * SIZE(%esi)
  187. FST 1 * SIZE(%esi)
  188. ALIGN_2
  189. .L74:
  190. decl %ecx
  191. jg .L71
  192. ALIGN_2
  193. .L83:
  194. #ifndef C_SUN
  195. ffreep %st(0)
  196. ffreep %st(0)
  197. #else
  198. .byte 0xdf
  199. .byte 0xc0
  200. .byte 0xdf
  201. .byte 0xc0
  202. #endif
  203. popl %esi
  204. popl %edi
  205. popl %ebp
  206. ret
  207. EPILOGUE