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

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