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.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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 M ARG1
  41. #define X ARG2
  42. #define INCX ARG3
  43. #define I ARG4
  44. #define NUM %r10
  45. #define RET %rax
  46. #ifndef USE_MIN
  47. #define FMOV fcmovbe
  48. #define IMOV cmovnbe
  49. #else
  50. #define FMOV fcmovnb
  51. #define IMOV cmovb
  52. #endif
  53. #include "l1param.h"
  54. PROLOGUE
  55. PROFCODE
  56. salq $ZBASE_SHIFT, INCX
  57. fldz
  58. xorq RET, RET
  59. testq M, M
  60. jle .L999
  61. testq INCX, INCX
  62. jle .L999
  63. ffreep %st
  64. movq $2, NUM
  65. movq $1, RET
  66. FLD 0 * SIZE(X)
  67. fabs
  68. FLD 1 * SIZE(X)
  69. fabs
  70. faddp %st, %st(1)
  71. addq INCX, X
  72. decq M
  73. jle .L999
  74. cmpq $2 * SIZE, INCX
  75. jne .L40
  76. movq M, I
  77. sarq $2, I
  78. jle .L20
  79. ALIGN_4
  80. .L10:
  81. #ifdef PREFETCH
  82. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  83. #endif
  84. FLD 0 * SIZE(X)
  85. fabs
  86. FLD 1 * SIZE(X)
  87. fabs
  88. faddp %st, %st(1)
  89. fcomi
  90. FMOV %st(1), %st(0)
  91. IMOV NUM, RET
  92. fxch %st(1)
  93. ffreep %st
  94. incq NUM
  95. FLD 2 * SIZE(X)
  96. fabs
  97. FLD 3 * SIZE(X)
  98. fabs
  99. faddp %st, %st(1)
  100. fcomi
  101. FMOV %st(1), %st(0)
  102. IMOV NUM, RET
  103. fxch %st(1)
  104. ffreep %st
  105. incq NUM
  106. FLD 4 * SIZE(X)
  107. fabs
  108. FLD 5 * SIZE(X)
  109. fabs
  110. faddp %st, %st(1)
  111. fcomi
  112. FMOV %st(1), %st(0)
  113. IMOV NUM, RET
  114. fxch %st(1)
  115. ffreep %st
  116. incq NUM
  117. FLD 6 * SIZE(X)
  118. fabs
  119. FLD 7 * SIZE(X)
  120. fabs
  121. faddp %st, %st(1)
  122. fcomi
  123. FMOV %st(1), %st(0)
  124. IMOV NUM, RET
  125. fxch %st(1)
  126. ffreep %st
  127. incq NUM
  128. addq $8 * SIZE, X
  129. decq I
  130. jg .L10
  131. ALIGN_4
  132. .L20:
  133. movq M, I
  134. andq $3, I
  135. jle .L999
  136. ALIGN_4
  137. .L21:
  138. FLD 0 * SIZE(X)
  139. fabs
  140. FLD 1 * SIZE(X)
  141. fabs
  142. faddp %st, %st(1)
  143. fcomi
  144. FMOV %st(1), %st(0)
  145. IMOV NUM, RET
  146. fxch %st(1)
  147. ffreep %st
  148. incq NUM
  149. addq $2 * SIZE, X
  150. decq I
  151. jg .L21
  152. jmp .L999
  153. ALIGN_4
  154. .L40:
  155. movq M, I
  156. sarq $2, I
  157. jle .L60
  158. ALIGN_4
  159. .L50:
  160. FLD 0 * SIZE(X)
  161. fabs
  162. FLD 1 * SIZE(X)
  163. fabs
  164. addq INCX, X
  165. faddp %st, %st(1)
  166. fcomi
  167. FMOV %st(1), %st(0)
  168. IMOV NUM, RET
  169. fxch %st(1)
  170. ffreep %st
  171. incq NUM
  172. FLD 0 * SIZE(X)
  173. fabs
  174. FLD 1 * SIZE(X)
  175. fabs
  176. addq INCX, X
  177. faddp %st, %st(1)
  178. fcomi
  179. FMOV %st(1), %st(0)
  180. IMOV NUM, RET
  181. fxch %st(1)
  182. ffreep %st
  183. incq NUM
  184. FLD 0 * SIZE(X)
  185. fabs
  186. FLD 1 * SIZE(X)
  187. fabs
  188. addq INCX, X
  189. faddp %st, %st(1)
  190. fcomi
  191. FMOV %st(1), %st(0)
  192. IMOV NUM, RET
  193. fxch %st(1)
  194. ffreep %st
  195. incq NUM
  196. FLD 0 * SIZE(X)
  197. fabs
  198. FLD 1 * SIZE(X)
  199. fabs
  200. addq INCX, X
  201. faddp %st, %st(1)
  202. fcomi
  203. FMOV %st(1), %st(0)
  204. IMOV NUM, RET
  205. fxch %st(1)
  206. ffreep %st
  207. incq NUM
  208. decq I
  209. jg .L50
  210. ALIGN_4
  211. .L60:
  212. movq M, I
  213. andq $3, I
  214. jle .L999
  215. ALIGN_4
  216. .L61:
  217. FLD 0 * SIZE(X)
  218. fabs
  219. FLD 1 * SIZE(X)
  220. fabs
  221. faddp %st, %st(1)
  222. fcomi
  223. FMOV %st(1), %st(0)
  224. IMOV NUM, RET
  225. fxch %st(1)
  226. ffreep %st
  227. incq NUM
  228. addq INCX, X
  229. decq I
  230. jg .L61
  231. ALIGN_4
  232. .L999:
  233. ffreep %st
  234. ret
  235. EPILOGUE