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 6.9 kB

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