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.

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