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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 STACK 8
  41. #define ARGS 0
  42. #define STACK_M 4 + STACK + ARGS(%esp)
  43. #define STACK_X 8 + STACK + ARGS(%esp)
  44. #define STACK_INCX 12 + STACK + ARGS(%esp)
  45. PROLOGUE
  46. #define M %ebx
  47. #define INCX %esi
  48. #define X %ecx
  49. #define I %edx
  50. #ifndef USE_MIN
  51. #define FMOV fcmovbe
  52. #else
  53. #define FMOV fcmovnbe
  54. #endif
  55. #include "l1param.h"
  56. pushl %esi
  57. pushl %ebx
  58. PROFCODE
  59. movl STACK_M, M
  60. movl STACK_INCX, INCX
  61. movl STACK_X, X
  62. #ifdef F_INTERFACE
  63. movl (M), M
  64. movl (INCX), INCX
  65. #endif
  66. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  67. EMMS
  68. #endif
  69. sall $BASE_SHIFT, INCX
  70. fldz
  71. testl M, M
  72. jle .L999
  73. testl INCX, INCX
  74. jle .L999
  75. fstp %st(0)
  76. FLD (X)
  77. #ifdef USE_ABS
  78. fabs
  79. #endif
  80. addl INCX, X
  81. decl M
  82. jle .L999
  83. cmpl $SIZE, INCX
  84. jne .L40
  85. movl M, I
  86. sarl $3, I
  87. jle .L20
  88. ALIGN_4
  89. .L10:
  90. #ifdef PREFETCH
  91. PREFETCH (PREFETCHSIZE + 0) - PREOFFSET(X)
  92. #endif
  93. FLD 0 * SIZE(X)
  94. #ifdef USE_ABS
  95. fabs
  96. #endif
  97. fcomi %st(1), %st
  98. FMOV %st(1), %st(0)
  99. fstp %st(1)
  100. FLD 1 * SIZE(X)
  101. #ifdef USE_ABS
  102. fabs
  103. #endif
  104. fcomi %st(1), %st
  105. FMOV %st(1), %st(0)
  106. fstp %st(1)
  107. FLD 2 * SIZE(X)
  108. #ifdef USE_ABS
  109. fabs
  110. #endif
  111. fcomi %st(1), %st
  112. FMOV %st(1), %st(0)
  113. fstp %st(1)
  114. FLD 3 * SIZE(X)
  115. #ifdef USE_ABS
  116. fabs
  117. #endif
  118. fcomi %st(1), %st
  119. FMOV %st(1), %st(0)
  120. fstp %st(1)
  121. FLD 4 * SIZE(X)
  122. #ifdef USE_ABS
  123. fabs
  124. #endif
  125. fcomi %st(1), %st
  126. FMOV %st(1), %st(0)
  127. fstp %st(1)
  128. FLD 5 * SIZE(X)
  129. #ifdef USE_ABS
  130. fabs
  131. #endif
  132. fcomi %st(1), %st
  133. FMOV %st(1), %st(0)
  134. fstp %st(1)
  135. FLD 6 * SIZE(X)
  136. #ifdef USE_ABS
  137. fabs
  138. #endif
  139. fcomi %st(1), %st
  140. FMOV %st(1), %st(0)
  141. fstp %st(1)
  142. FLD 7 * SIZE(X)
  143. #ifdef USE_ABS
  144. fabs
  145. #endif
  146. fcomi %st(1), %st
  147. FMOV %st(1), %st(0)
  148. fstp %st(1)
  149. addl $8 * SIZE, X
  150. decl I
  151. jg .L10
  152. ALIGN_4
  153. .L20:
  154. movl M, I
  155. andl $7, I
  156. jle .L999
  157. ALIGN_4
  158. .L21:
  159. FLD 0 * SIZE(X)
  160. #ifdef USE_ABS
  161. fabs
  162. #endif
  163. fcomi %st(1), %st
  164. FMOV %st(1), %st(0)
  165. fstp %st(1)
  166. addl $1 * SIZE, X
  167. decl I
  168. jg .L21
  169. jmp .L999
  170. ALIGN_4
  171. .L40:
  172. movl M, I
  173. sarl $3, I
  174. jle .L60
  175. ALIGN_4
  176. .L50:
  177. FLD 0 * SIZE(X)
  178. addl INCX, X
  179. #ifdef USE_ABS
  180. fabs
  181. #endif
  182. fcomi %st(1), %st
  183. FMOV %st(1), %st(0)
  184. fstp %st(1)
  185. FLD 0 * SIZE(X)
  186. addl INCX, X
  187. #ifdef USE_ABS
  188. fabs
  189. #endif
  190. fcomi %st(1), %st
  191. FMOV %st(1), %st(0)
  192. fstp %st(1)
  193. FLD 0 * SIZE(X)
  194. addl INCX, X
  195. #ifdef USE_ABS
  196. fabs
  197. #endif
  198. fcomi %st(1), %st
  199. FMOV %st(1), %st(0)
  200. fstp %st(1)
  201. FLD 0 * SIZE(X)
  202. addl INCX, X
  203. #ifdef USE_ABS
  204. fabs
  205. #endif
  206. fcomi %st(1), %st
  207. FMOV %st(1), %st(0)
  208. fstp %st(1)
  209. FLD 0 * SIZE(X)
  210. addl INCX, X
  211. #ifdef USE_ABS
  212. fabs
  213. #endif
  214. fcomi %st(1), %st
  215. FMOV %st(1), %st(0)
  216. fstp %st(1)
  217. FLD 0 * SIZE(X)
  218. addl INCX, X
  219. #ifdef USE_ABS
  220. fabs
  221. #endif
  222. fcomi %st(1), %st
  223. FMOV %st(1), %st(0)
  224. fstp %st(1)
  225. FLD 0 * SIZE(X)
  226. addl INCX, X
  227. #ifdef USE_ABS
  228. fabs
  229. #endif
  230. fcomi %st(1), %st
  231. FMOV %st(1), %st(0)
  232. fstp %st(1)
  233. FLD 0 * SIZE(X)
  234. addl INCX, X
  235. #ifdef USE_ABS
  236. fabs
  237. #endif
  238. fcomi %st(1), %st
  239. FMOV %st(1), %st(0)
  240. fstp %st(1)
  241. decl I
  242. jg .L50
  243. ALIGN_4
  244. .L60:
  245. movl M, I
  246. andl $7, I
  247. jle .L999
  248. ALIGN_4
  249. .L61:
  250. FLD 0 * SIZE(X)
  251. #ifdef USE_ABS
  252. fabs
  253. #endif
  254. fcomi %st(1), %st
  255. FMOV %st(1), %st(0)
  256. fstp %st(1)
  257. addl INCX, X
  258. decl I
  259. jg .L61
  260. ALIGN_4
  261. .L999:
  262. popl %ebx
  263. popl %esi
  264. ret
  265. EPILOGUE