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.

scal.S 7.0 kB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. PROLOGUE
  41. pushl %edi
  42. pushl %esi
  43. pushl %ebx
  44. PROFCODE
  45. #if defined(F_INTERFACE_GFORT) || defined(F_INTERFACE_G95)
  46. EMMS
  47. #endif
  48. movl 16(%esp),%edx
  49. FLD 28(%esp)
  50. #ifdef XDOUBLE
  51. movl 44(%esp),%edi
  52. movl 48(%esp),%esi
  53. movl 64(%esp),%ecx
  54. #elif defined(DOUBLE)
  55. movl 36(%esp),%edi
  56. movl 40(%esp),%esi
  57. movl 56(%esp),%ecx
  58. #else
  59. movl 32(%esp),%edi
  60. movl 36(%esp),%esi
  61. movl 52(%esp),%ecx
  62. #endif
  63. ftst
  64. fnstsw %ax
  65. andb $68, %ah
  66. je .L300 # Alpha != ZERO
  67. cmpl $1,%ecx # dummy2 flag
  68. je .L300
  69. /* Alpha == ZERO */
  70. cmpl $1,%esi
  71. jne .L104
  72. movl %edx, %ecx # ecx = n
  73. sarl $3, %ecx # (n >> 3)
  74. jle .L102
  75. ALIGN_4
  76. .L101:
  77. #ifndef XDOUBLE
  78. FSTU 0 * SIZE(%edi)
  79. FSTU 1 * SIZE(%edi)
  80. FSTU 2 * SIZE(%edi)
  81. FSTU 3 * SIZE(%edi)
  82. FSTU 4 * SIZE(%edi)
  83. FSTU 5 * SIZE(%edi)
  84. FSTU 6 * SIZE(%edi)
  85. FSTU 7 * SIZE(%edi)
  86. #else
  87. fld %st
  88. FST 0 * SIZE(%edi)
  89. fld %st
  90. FST 1 * SIZE(%edi)
  91. fld %st
  92. FST 2 * SIZE(%edi)
  93. fld %st
  94. FST 3 * SIZE(%edi)
  95. fld %st
  96. FST 4 * SIZE(%edi)
  97. fld %st
  98. FST 5 * SIZE(%edi)
  99. fld %st
  100. FST 6 * SIZE(%edi)
  101. fld %st
  102. FST 7 * SIZE(%edi)
  103. #endif
  104. addl $8 * SIZE, %edi
  105. decl %ecx
  106. jg .L101
  107. ALIGN_4
  108. .L102:
  109. movl %edx, %ecx
  110. andl $7, %ecx
  111. jle .L999
  112. ALIGN_4
  113. .L103:
  114. #ifndef XDOUBLE
  115. FSTU 0 * SIZE(%edi)
  116. #else
  117. fld %st
  118. FST 0 * SIZE(%edi)
  119. #endif
  120. addl $SIZE, %edi
  121. decl %ecx
  122. jg .L103
  123. jmp .L999
  124. ALIGN_4
  125. .L104:
  126. sall $BASE_SHIFT, %esi
  127. movl %edx, %ecx # ecx = n
  128. sarl $3, %ecx # (n >> 3)
  129. jle .L106
  130. ALIGN_4
  131. .L105:
  132. #ifndef XDOUBLE
  133. FSTU 0 * SIZE(%edi)
  134. addl %esi, %edi
  135. FSTU 0 * SIZE(%edi)
  136. addl %esi, %edi
  137. FSTU 0 * SIZE(%edi)
  138. addl %esi, %edi
  139. FSTU 0 * SIZE(%edi)
  140. addl %esi, %edi
  141. FSTU 0 * SIZE(%edi)
  142. addl %esi, %edi
  143. FSTU 0 * SIZE(%edi)
  144. addl %esi, %edi
  145. FSTU 0 * SIZE(%edi)
  146. addl %esi, %edi
  147. FSTU 0 * SIZE(%edi)
  148. addl %esi, %edi
  149. #else
  150. fld %st
  151. FST 0 * SIZE(%edi)
  152. addl %esi, %edi
  153. fld %st
  154. FST 0 * SIZE(%edi)
  155. addl %esi, %edi
  156. fld %st
  157. FST 0 * SIZE(%edi)
  158. addl %esi, %edi
  159. fld %st
  160. FST 0 * SIZE(%edi)
  161. addl %esi, %edi
  162. fld %st
  163. FST 0 * SIZE(%edi)
  164. addl %esi, %edi
  165. fld %st
  166. FST 0 * SIZE(%edi)
  167. addl %esi, %edi
  168. fld %st
  169. FST 0 * SIZE(%edi)
  170. addl %esi, %edi
  171. fld %st
  172. FST 0 * SIZE(%edi)
  173. addl %esi, %edi
  174. #endif
  175. decl %ecx
  176. jg .L105
  177. ALIGN_4
  178. .L106:
  179. movl %edx, %ecx
  180. andl $7, %ecx
  181. jle .L999
  182. ALIGN_4
  183. .L107:
  184. #ifndef XDOUBLE
  185. FSTU 0 * SIZE(%edi)
  186. #else
  187. fld %st
  188. FST 0 * SIZE(%edi)
  189. #endif
  190. addl %esi, %edi
  191. decl %ecx
  192. jg .L107
  193. jmp .L999
  194. ALIGN_4
  195. /* Alpha != ZERO */
  196. .L300:
  197. cmpl $1,%esi
  198. jne .L304
  199. movl %edx, %ecx # ecx = n
  200. sarl $3, %ecx # (n >> 3)
  201. jle .L302
  202. ALIGN_4
  203. .L301:
  204. FLD 0 * SIZE(%edi)
  205. fmul %st(1), %st
  206. FST 0 * SIZE(%edi)
  207. FLD 1 * SIZE(%edi)
  208. fmul %st(1), %st
  209. FST 1 * SIZE(%edi)
  210. FLD 2 * SIZE(%edi)
  211. fmul %st(1), %st
  212. FST 2 * SIZE(%edi)
  213. FLD 3 * SIZE(%edi)
  214. fmul %st(1), %st
  215. FST 3 * SIZE(%edi)
  216. FLD 4 * SIZE(%edi)
  217. fmul %st(1), %st
  218. FST 4 * SIZE(%edi)
  219. FLD 5 * SIZE(%edi)
  220. fmul %st(1), %st
  221. FST 5 * SIZE(%edi)
  222. FLD 6 * SIZE(%edi)
  223. fmul %st(1), %st
  224. FST 6 * SIZE(%edi)
  225. FLD 7 * SIZE(%edi)
  226. fmul %st(1), %st
  227. FST 7 * SIZE(%edi)
  228. addl $8 * SIZE, %edi
  229. decl %ecx
  230. jg .L301
  231. ALIGN_4
  232. .L302:
  233. movl %edx, %ecx
  234. andl $7, %ecx
  235. jle .L999
  236. ALIGN_4
  237. .L303:
  238. FLD 0 * SIZE(%edi)
  239. fmul %st(1), %st
  240. FST 0 * SIZE(%edi)
  241. addl $SIZE, %edi
  242. decl %ecx
  243. jg .L303
  244. jmp .L999
  245. ALIGN_4
  246. .L304:
  247. sall $BASE_SHIFT, %esi
  248. movl %edx, %ecx # ecx = n
  249. sarl $3, %ecx # (n >> 3)
  250. jle .L306
  251. ALIGN_4
  252. .L305:
  253. FLD 0 * SIZE(%edi)
  254. fmul %st(1), %st
  255. FST 0 * SIZE(%edi)
  256. addl %esi, %edi
  257. FLD 0 * SIZE(%edi)
  258. fmul %st(1), %st
  259. FST 0 * SIZE(%edi)
  260. addl %esi, %edi
  261. FLD 0 * SIZE(%edi)
  262. fmul %st(1), %st
  263. FST 0 * SIZE(%edi)
  264. addl %esi, %edi
  265. FLD 0 * SIZE(%edi)
  266. fmul %st(1), %st
  267. FST 0 * SIZE(%edi)
  268. addl %esi, %edi
  269. FLD 0 * SIZE(%edi)
  270. fmul %st(1), %st
  271. FST 0 * SIZE(%edi)
  272. addl %esi, %edi
  273. FLD 0 * SIZE(%edi)
  274. fmul %st(1), %st
  275. FST 0 * SIZE(%edi)
  276. addl %esi, %edi
  277. FLD 0 * SIZE(%edi)
  278. fmul %st(1), %st
  279. FST 0 * SIZE(%edi)
  280. addl %esi, %edi
  281. FLD 0 * SIZE(%edi)
  282. fmul %st(1), %st
  283. FST 0 * SIZE(%edi)
  284. addl %esi, %edi
  285. decl %ecx
  286. jg .L305
  287. ALIGN_4
  288. .L306:
  289. movl %edx, %ecx
  290. andl $7, %ecx
  291. jle .L999
  292. ALIGN_4
  293. .L307:
  294. FLD 0 * SIZE(%edi)
  295. fmul %st(1), %st
  296. FST 0 * SIZE(%edi)
  297. addl %esi, %edi
  298. decl %ecx
  299. jg .L307
  300. ALIGN_4
  301. .L999:
  302. ffreep %st(0)
  303. xorl %eax,%eax
  304. popl %ebx
  305. popl %esi
  306. popl %edi
  307. ret
  308. EPILOGUE