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.

zamax.S 4.9 kB

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