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.

zswap.S 6.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 0
  42. #define N 4 + STACK + ARGS(%esp)
  43. #ifdef XDOUBLE
  44. #define X 48 + STACK + ARGS(%esp)
  45. #define INCX 52 + STACK + ARGS(%esp)
  46. #define Y 56 + STACK + ARGS(%esp)
  47. #define INCY 60 + STACK + ARGS(%esp)
  48. #elif defined(DOUBLE)
  49. #define X 32 + STACK + ARGS(%esp)
  50. #define INCX 36 + STACK + ARGS(%esp)
  51. #define Y 40 + STACK + ARGS(%esp)
  52. #define INCY 44 + STACK + ARGS(%esp)
  53. #else
  54. #define X 24 + STACK + ARGS(%esp)
  55. #define INCX 28 + STACK + ARGS(%esp)
  56. #define Y 32 + STACK + ARGS(%esp)
  57. #define INCY 36 + STACK + ARGS(%esp)
  58. #endif
  59. PROLOGUE
  60. pushl %ebp
  61. pushl %edi
  62. pushl %esi
  63. pushl %ebx
  64. PROFCODE
  65. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  66. EMMS
  67. #endif
  68. movl N, %edx
  69. movl X, %esi
  70. movl Y, %edi
  71. movl INCX, %ebx
  72. movl INCY, %ecx
  73. sall $ZBASE_SHIFT, %ebx
  74. sall $ZBASE_SHIFT, %ecx
  75. cmpl $2 * SIZE, %ebx
  76. jne .L14
  77. cmpl $2 * SIZE, %ecx
  78. jne .L14
  79. movl %edx, %eax
  80. sarl $1, %eax
  81. jle .L15
  82. ALIGN_3
  83. .L16:
  84. #if defined(DOUBLE) || defined(XDOUBLE)
  85. FLD 3 * SIZE(%esi)
  86. FLD 2 * SIZE(%esi)
  87. FLD 1 * SIZE(%esi)
  88. FLD 0 * SIZE(%esi)
  89. FLD 3 * SIZE(%edi)
  90. FLD 2 * SIZE(%edi)
  91. FLD 1 * SIZE(%edi)
  92. FLD 0 * SIZE(%edi)
  93. FST 0 * SIZE(%esi)
  94. FST 1 * SIZE(%esi)
  95. FST 2 * SIZE(%esi)
  96. FST 3 * SIZE(%esi)
  97. FST 0 * SIZE(%edi)
  98. FST 1 * SIZE(%edi)
  99. FST 2 * SIZE(%edi)
  100. FST 3 * SIZE(%edi)
  101. #else
  102. fldl 2 * SIZE(%esi)
  103. fldl 0 * SIZE(%esi)
  104. fldl 2 * SIZE(%edi)
  105. fldl 0 * SIZE(%edi)
  106. fstpl 0 * SIZE(%esi)
  107. fstpl 2 * SIZE(%esi)
  108. fstpl 0 * SIZE(%edi)
  109. fstpl 2 * SIZE(%edi)
  110. #endif
  111. addl $4 * SIZE, %esi
  112. addl $4 * SIZE, %edi
  113. decl %eax
  114. jg .L16
  115. ALIGN_3
  116. .L15:
  117. movl %edx, %eax
  118. andl $1, %eax
  119. jle .L27
  120. ALIGN_3
  121. .L22:
  122. #if defined(DOUBLE) || defined(XDOUBLE)
  123. FLD 1 * SIZE(%esi)
  124. FLD 0 * SIZE(%esi)
  125. FLD 1 * SIZE(%edi)
  126. FLD 0 * SIZE(%edi)
  127. FST 0 * SIZE(%esi)
  128. FST 1 * SIZE(%esi)
  129. FST 0 * SIZE(%edi)
  130. FST 1 * SIZE(%edi)
  131. #else
  132. fldl 0 * SIZE(%esi)
  133. fldl 0 * SIZE(%edi)
  134. fstpl 0 * SIZE(%esi)
  135. fstpl 0 * SIZE(%edi)
  136. #endif
  137. jmp .L27
  138. ALIGN_3
  139. /* INCX != 1 or INCY != 1 */
  140. .L14:
  141. movl %edx, %eax
  142. sarl $1, %eax
  143. jle .L28
  144. ALIGN_2
  145. .L29:
  146. #if defined(DOUBLE) || defined(XDOUBLE)
  147. FLD 1 * SIZE(%esi)
  148. FLD 0 * SIZE(%esi)
  149. addl %ebx, %esi
  150. FLD 1 * SIZE(%esi)
  151. FLD 0 * SIZE(%esi)
  152. FLD 1 * SIZE(%edi)
  153. FLD 0 * SIZE(%edi)
  154. addl %ecx, %edi
  155. FLD 1 * SIZE(%edi)
  156. FLD 0 * SIZE(%edi)
  157. FST 0 * SIZE(%esi)
  158. FST 1 * SIZE(%esi)
  159. subl %ebx, %esi
  160. FST 0 * SIZE(%esi)
  161. FST 1 * SIZE(%esi)
  162. leal (%esi, %ebx, 2), %esi
  163. FST 0 * SIZE(%edi)
  164. FST 1 * SIZE(%edi)
  165. subl %ecx, %edi
  166. FST 0 * SIZE(%edi)
  167. FST 1 * SIZE(%edi)
  168. leal (%edi, %ecx, 2), %edi
  169. #else
  170. fldl 0 * SIZE(%esi)
  171. addl %ebx, %esi
  172. fldl 0 * SIZE(%esi)
  173. fldl 0 * SIZE(%edi)
  174. addl %ecx, %edi
  175. fldl 0 * SIZE(%edi)
  176. fstpl 0 * SIZE(%esi)
  177. subl %ebx, %esi
  178. fstpl 0 * SIZE(%esi)
  179. leal (%esi, %ebx, 2), %esi
  180. fstpl 0 * SIZE(%edi)
  181. subl %ecx, %edi
  182. fstpl 0 * SIZE(%edi)
  183. leal (%edi, %ecx, 2), %edi
  184. #endif
  185. decl %eax
  186. jg .L29
  187. ALIGN_3
  188. .L28:
  189. movl %edx, %eax
  190. andl $1, %eax
  191. jle .L27
  192. ALIGN_3
  193. .L35:
  194. #if defined(DOUBLE) || defined(XDOUBLE)
  195. FLD 1 * SIZE(%esi)
  196. FLD 0 * SIZE(%esi)
  197. FLD 1 * SIZE(%edi)
  198. FLD 0 * SIZE(%edi)
  199. FST 0 * SIZE(%esi)
  200. FST 1 * SIZE(%esi)
  201. FST 0 * SIZE(%edi)
  202. FST 1 * SIZE(%edi)
  203. #else
  204. fldl 0 * SIZE(%esi)
  205. fldl 0 * SIZE(%edi)
  206. fstpl 0 * SIZE(%esi)
  207. fstpl 0 * SIZE(%edi)
  208. #endif
  209. ALIGN_3
  210. .L27:
  211. xorl %eax,%eax
  212. popl %ebx
  213. popl %esi
  214. popl %edi
  215. popl %ebp
  216. ret
  217. EPILOGUE