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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 X 8 + STACK + ARGS(%esp)
  44. #define INCX 12 + STACK + ARGS(%esp)
  45. #define Y 16 + STACK + ARGS(%esp)
  46. #define INCY 20 + STACK + ARGS(%esp)
  47. PROLOGUE
  48. pushl %edi
  49. pushl %esi
  50. pushl %ebx
  51. PROFCODE
  52. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  53. EMMS
  54. #endif
  55. movl M, %ebx
  56. movl X, %ecx
  57. movl INCX, %esi
  58. movl Y, %edx
  59. movl INCY, %edi
  60. testl %ebx, %ebx # if m == 0 goto End
  61. jle .L999
  62. #if SIZE > 8
  63. sall $BASE_SHIFT, %esi
  64. sall $BASE_SHIFT, %edi
  65. #else
  66. leal (, %esi, SIZE), %esi
  67. leal (, %edi, SIZE), %edi
  68. #endif
  69. cmpl $SIZE, %esi # if incx != 1
  70. jne .L100
  71. cmpl $SIZE, %edi # if incy != 1
  72. jne .L100
  73. movl %ebx, %eax # i = m
  74. sarl $3, %eax
  75. jle .L20
  76. ALIGN_2
  77. .L11:
  78. FLD 7 * SIZE(%ecx)
  79. FLD 6 * SIZE(%ecx)
  80. FLD 5 * SIZE(%ecx)
  81. FLD 4 * SIZE(%ecx)
  82. FLD 3 * SIZE(%ecx)
  83. FLD 2 * SIZE(%ecx)
  84. FLD 1 * SIZE(%ecx)
  85. FLD 0 * SIZE(%ecx)
  86. FST 0 * SIZE(%edx)
  87. FST 1 * SIZE(%edx)
  88. FST 2 * SIZE(%edx)
  89. FST 3 * SIZE(%edx)
  90. FST 4 * SIZE(%edx)
  91. FST 5 * SIZE(%edx)
  92. FST 6 * SIZE(%edx)
  93. FST 7 * SIZE(%edx)
  94. addl $8 * SIZE, %ecx
  95. addl $8 * SIZE, %edx
  96. decl %eax
  97. jg .L11
  98. ALIGN_2
  99. .L20:
  100. movl %ebx, %eax # i = m
  101. andl $7, %eax
  102. jle .L99
  103. ALIGN_2
  104. .L21:
  105. FLD (%ecx)
  106. FST (%edx)
  107. addl $SIZE, %ecx
  108. addl $SIZE, %edx
  109. decl %eax
  110. jg .L21
  111. .L99:
  112. xorl %eax,%eax
  113. popl %ebx
  114. popl %esi
  115. popl %edi
  116. ret
  117. ALIGN_3
  118. .L100:
  119. movl %ebx, %eax
  120. sarl $3, %eax
  121. jle .L120
  122. ALIGN_2
  123. .L111:
  124. FLD (%ecx)
  125. addl %esi, %ecx
  126. FLD (%ecx)
  127. addl %esi, %ecx
  128. FLD (%ecx)
  129. addl %esi, %ecx
  130. FLD (%ecx)
  131. addl %esi, %ecx
  132. FLD (%ecx)
  133. addl %esi, %ecx
  134. FLD (%ecx)
  135. addl %esi, %ecx
  136. FLD (%ecx)
  137. addl %esi, %ecx
  138. FLD (%ecx)
  139. addl %esi, %ecx
  140. fxch %st(7)
  141. FST (%edx)
  142. addl %edi, %edx
  143. fxch %st(5)
  144. FST (%edx)
  145. addl %edi, %edx
  146. fxch %st(3)
  147. FST (%edx)
  148. addl %edi, %edx
  149. fxch %st(1)
  150. FST (%edx)
  151. addl %edi, %edx
  152. FST (%edx)
  153. addl %edi, %edx
  154. FST (%edx)
  155. addl %edi, %edx
  156. FST (%edx)
  157. addl %edi, %edx
  158. FST (%edx)
  159. addl %edi, %edx
  160. decl %eax
  161. jg .L111
  162. .L120:
  163. movl %ebx, %eax
  164. andl $7, %eax
  165. jle .L999
  166. ALIGN_2
  167. .L121:
  168. FLD (%ecx)
  169. FST (%edx)
  170. addl %esi, %ecx
  171. addl %edi, %edx
  172. decl %eax
  173. jg .L121
  174. .L999:
  175. xorl %eax,%eax
  176. popl %ebx
  177. popl %esi
  178. popl %edi
  179. ret
  180. EPILOGUE