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

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