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.

izamax.S 5.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 STACK_M 4 + STACK + ARGS(%esp)
  43. #define STACK_X 8 + STACK + ARGS(%esp)
  44. #define STACK_INCX 12 + STACK + ARGS(%esp)
  45. PROLOGUE
  46. #define M %ebx
  47. #define INCX %esi
  48. #define X %ecx
  49. #define I %edx
  50. #define NUM %edi
  51. #define RET %eax
  52. #ifndef USE_MIN
  53. #define FMOV fcmovbe
  54. #define IMOV cmovnbe
  55. #else
  56. #define FMOV fcmovnb
  57. #define IMOV cmovb
  58. #endif
  59. #include "l1param.h"
  60. pushl %ebp
  61. pushl %edi
  62. pushl %esi
  63. pushl %ebx
  64. PROFCODE
  65. movl STACK_M, M
  66. movl STACK_INCX, INCX
  67. movl STACK_X, X
  68. #ifdef F_INTERFACE
  69. movl (M), M
  70. movl (INCX), INCX
  71. #endif
  72. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  73. EMMS
  74. #endif
  75. sall $ZBASE_SHIFT, INCX
  76. fldz
  77. xorl RET, RET
  78. testl M, M
  79. jle .L999
  80. testl INCX, INCX
  81. jle .L999
  82. fstp %st(0)
  83. movl $2, NUM
  84. movl $1, RET
  85. FLD 0 * SIZE(X)
  86. fabs
  87. FLD 1 * SIZE(X)
  88. fabs
  89. faddp %st, %st(1)
  90. addl INCX, X
  91. decl M
  92. jle .L999
  93. cmpl $2 * SIZE, INCX
  94. jne .L40
  95. movl M, I
  96. sarl $2, I
  97. jle .L20
  98. ALIGN_4
  99. .L10:
  100. #ifdef PREFETCH
  101. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  102. #endif
  103. FLD 0 * SIZE(X)
  104. fabs
  105. FLD 1 * SIZE(X)
  106. fabs
  107. faddp %st, %st(1)
  108. fcomi %st(1), %st
  109. FMOV %st(1), %st(0)
  110. IMOV NUM, RET
  111. fstp %st(1)
  112. incl NUM
  113. FLD 2 * SIZE(X)
  114. fabs
  115. FLD 3 * SIZE(X)
  116. fabs
  117. faddp %st, %st(1)
  118. fcomi %st(1), %st
  119. FMOV %st(1), %st(0)
  120. IMOV NUM, RET
  121. fstp %st(1)
  122. incl NUM
  123. FLD 4 * SIZE(X)
  124. fabs
  125. FLD 5 * SIZE(X)
  126. fabs
  127. faddp %st, %st(1)
  128. fcomi %st(1), %st
  129. FMOV %st(1), %st(0)
  130. IMOV NUM, RET
  131. fstp %st(1)
  132. incl NUM
  133. FLD 6 * SIZE(X)
  134. fabs
  135. FLD 7 * SIZE(X)
  136. fabs
  137. faddp %st, %st(1)
  138. fcomi %st(1), %st
  139. FMOV %st(1), %st(0)
  140. IMOV NUM, RET
  141. fstp %st(1)
  142. incl NUM
  143. addl $8 * SIZE, X
  144. decl I
  145. jg .L10
  146. ALIGN_4
  147. .L20:
  148. movl M, I
  149. andl $3, I
  150. jle .L999
  151. ALIGN_4
  152. .L21:
  153. FLD 0 * SIZE(X)
  154. fabs
  155. FLD 1 * SIZE(X)
  156. fabs
  157. faddp %st, %st(1)
  158. fcomi %st(1), %st
  159. FMOV %st(1), %st(0)
  160. IMOV NUM, RET
  161. fstp %st(1)
  162. incl NUM
  163. addl $2 * SIZE, X
  164. decl I
  165. jg .L21
  166. jmp .L999
  167. ALIGN_4
  168. .L40:
  169. movl M, I
  170. sarl $2, I
  171. jle .L60
  172. ALIGN_4
  173. .L50:
  174. FLD 0 * SIZE(X)
  175. fabs
  176. FLD 1 * SIZE(X)
  177. fabs
  178. addl INCX, X
  179. faddp %st, %st(1)
  180. fcomi %st(1), %st
  181. FMOV %st(1), %st(0)
  182. IMOV NUM, RET
  183. fstp %st(1)
  184. incl NUM
  185. FLD 0 * SIZE(X)
  186. fabs
  187. FLD 1 * SIZE(X)
  188. fabs
  189. addl INCX, X
  190. faddp %st, %st(1)
  191. fcomi %st(1), %st
  192. FMOV %st(1), %st(0)
  193. IMOV NUM, RET
  194. fstp %st(1)
  195. incl NUM
  196. FLD 0 * SIZE(X)
  197. fabs
  198. FLD 1 * SIZE(X)
  199. fabs
  200. addl INCX, X
  201. faddp %st, %st(1)
  202. fcomi %st(1), %st
  203. FMOV %st(1), %st(0)
  204. IMOV NUM, RET
  205. fstp %st(1)
  206. incl NUM
  207. FLD 0 * SIZE(X)
  208. fabs
  209. FLD 1 * SIZE(X)
  210. fabs
  211. addl INCX, X
  212. faddp %st, %st(1)
  213. fcomi %st(1), %st
  214. FMOV %st(1), %st(0)
  215. IMOV NUM, RET
  216. fstp %st(1)
  217. incl NUM
  218. decl I
  219. jg .L50
  220. ALIGN_4
  221. .L60:
  222. movl M, I
  223. andl $3, I
  224. jle .L999
  225. ALIGN_4
  226. .L61:
  227. FLD 0 * SIZE(X)
  228. fabs
  229. FLD 1 * SIZE(X)
  230. fabs
  231. faddp %st, %st(1)
  232. fcomi %st(1), %st
  233. FMOV %st(1), %st(0)
  234. IMOV NUM, RET
  235. fstp %st(1)
  236. incl NUM
  237. addl INCX, X
  238. decl I
  239. jg .L61
  240. ALIGN_4
  241. .L999:
  242. fstp %st(0)
  243. popl %ebx
  244. popl %esi
  245. popl %edi
  246. popl %ebp
  247. ret
  248. EPILOGUE