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.

dnrm2.S 7.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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. #include "version.h"
  41. #define PREFETCH_SIZE 80
  42. #define N $16
  43. #define X $17
  44. #define INCX $18
  45. #define XX $19
  46. #define I $0
  47. #define a0 $f0
  48. #define a1 $f1
  49. #define a2 $f10
  50. #define a3 $f11
  51. #define t0 $f12
  52. #define t1 $f13
  53. #define t2 $f14
  54. #define t3 $f15
  55. #define x0 $f16
  56. #define x1 $f17
  57. #define x2 $f18
  58. #define x3 $f19
  59. #define x4 $f20
  60. #define x5 $f21
  61. #define x6 $f22
  62. #define x7 $f23
  63. PROLOGUE
  64. #if defined(EV4) || defined(EV5)
  65. .frame $30,16,$26,0
  66. .mask 0x4000000,-16
  67. ldah $29, 0($27) !gpdisp!1
  68. lda $29, 0($29) !gpdisp!1
  69. lda $sp, -16($sp)
  70. ldq $27, sqrt($29) !literal!2
  71. stq $26, 0($sp)
  72. PROFCODE
  73. .prologue 1
  74. #else
  75. PROFCODE
  76. #endif
  77. fclr a0
  78. SXADDQ INCX, 0, INCX
  79. fclr a1
  80. ble N, $L999
  81. fclr a2
  82. cmpeq INCX, SIZE, $0
  83. fclr a3
  84. beq $0, $L20
  85. fclr t0
  86. sra N, 4, I
  87. fclr t1
  88. ble I, $L15
  89. fclr t2
  90. LD x0, 0 * SIZE(X)
  91. fclr t3
  92. LD x1, 1 * SIZE(X)
  93. LD x2, 2 * SIZE(X)
  94. LD x3, 3 * SIZE(X)
  95. LD x4, 4 * SIZE(X)
  96. LD x5, 5 * SIZE(X)
  97. LD x6, 6 * SIZE(X)
  98. LD x7, 7 * SIZE(X)
  99. lda I, -1(I)
  100. ble I, $L12
  101. .align 4
  102. $L11:
  103. addt a0, t0, a0
  104. ldl $31, (PREFETCH_SIZE) * SIZE(X)
  105. mult x0, x0, t0
  106. LD x0, 8 * SIZE(X)
  107. addt a1, t1, a1
  108. mov X, XX
  109. mult x1, x1, t1
  110. LD x1, 9 * SIZE(X)
  111. addt a2, t2, a2
  112. unop
  113. mult x2, x2, t2
  114. LD x2, 10 * SIZE(X)
  115. addt a3, t3, a3
  116. unop
  117. mult x3, x3, t3
  118. LD x3, 11 * SIZE(X)
  119. addt a0, t0, a0
  120. unop
  121. mult x4, x4, t0
  122. LD x4, 12 * SIZE(X)
  123. addt a1, t1, a1
  124. unop
  125. mult x5, x5, t1
  126. LD x5, 13 * SIZE(X)
  127. addt a2, t2, a2
  128. unop
  129. mult x6, x6, t2
  130. LD x6, 14 * SIZE(X)
  131. addt a3, t3, a3
  132. unop
  133. mult x7, x7, t3
  134. LD x7, 15 * SIZE(X)
  135. addt a0, t0, a0
  136. unop
  137. mult x0, x0, t0
  138. LD x0, 16 * SIZE(X)
  139. addt a1, t1, a1
  140. lda X, 16 * SIZE(X)
  141. mult x1, x1, t1
  142. LD x1, 17 * SIZE(XX)
  143. addt a2, t2, a2
  144. unop
  145. mult x2, x2, t2
  146. LD x2, 18 * SIZE(XX)
  147. addt a3, t3, a3
  148. unop
  149. mult x3, x3, t3
  150. LD x3, 19 * SIZE(XX)
  151. addt a0, t0, a0
  152. unop
  153. mult x4, x4, t0
  154. LD x4, 20 * SIZE(XX)
  155. addt a1, t1, a1
  156. lda I, -1(I)
  157. mult x5, x5, t1
  158. LD x5, 21 * SIZE(XX)
  159. addt a2, t2, a2
  160. unop
  161. mult x6, x6, t2
  162. LD x6, 22 * SIZE(XX)
  163. addt a3, t3, a3
  164. mult x7, x7, t3
  165. LD x7, 23 * SIZE(XX)
  166. bgt I, $L11
  167. .align 4
  168. $L12:
  169. addt a0, t0, a0
  170. mov X, XX
  171. mult x0, x0, t0
  172. LD x0, 8 * SIZE(X)
  173. addt a1, t1, a1
  174. unop
  175. mult x1, x1, t1
  176. LD x1, 9 * SIZE(X)
  177. addt a2, t2, a2
  178. unop
  179. mult x2, x2, t2
  180. LD x2, 10 * SIZE(X)
  181. addt a3, t3, a3
  182. unop
  183. mult x3, x3, t3
  184. LD x3, 11 * SIZE(X)
  185. addt a0, t0, a0
  186. unop
  187. mult x4, x4, t0
  188. LD x4, 12 * SIZE(XX)
  189. addt a1, t1, a1
  190. unop
  191. mult x5, x5, t1
  192. LD x5, 13 * SIZE(XX)
  193. addt a2, t2, a2
  194. unop
  195. mult x6, x6, t2
  196. LD x6, 14 * SIZE(XX)
  197. addt a3, t3, a3
  198. lda X, 16 * SIZE(X)
  199. mult x7, x7, t3
  200. LD x7, 15 * SIZE(XX)
  201. addt a0, t0, a0
  202. mult x0, x0, t0
  203. addt a1, t1, a1
  204. mult x1, x1, t1
  205. addt a2, t2, a2
  206. mult x2, x2, t2
  207. addt a3, t3, a3
  208. mult x3, x3, t3
  209. addt a0, t0, a0
  210. mult x4, x4, t0
  211. addt a1, t1, a1
  212. mult x5, x5, t1
  213. addt a2, t2, a2
  214. mult x6, x6, t2
  215. addt a3, t3, a3
  216. mult x7, x7, t3
  217. addt a1, t1, a1
  218. addt a2, t2, a2
  219. addt a3, t3, a3
  220. .align 4
  221. $L15:
  222. and N, 15, I
  223. ble I, $L998
  224. .align 4
  225. $L16:
  226. LD x0, 0 * SIZE(X)
  227. lda X, 1 * SIZE(X)
  228. addt a0, t0, a0
  229. mult x0, x0, t0
  230. lda I, -1(I)
  231. bgt I, $L16
  232. bsr $31, $L998
  233. .align 4
  234. $L20:
  235. fclr t0
  236. sra N, 3, I
  237. fclr t1
  238. ble I, $L25
  239. fclr t2
  240. fclr t3
  241. LD x0, 0 * SIZE(X)
  242. addq X, INCX, X
  243. LD x1, 0 * SIZE(X)
  244. addq X, INCX, X
  245. LD x2, 0 * SIZE(X)
  246. addq X, INCX, X
  247. LD x3, 0 * SIZE(X)
  248. addq X, INCX, X
  249. LD x4, 0 * SIZE(X)
  250. addq X, INCX, X
  251. LD x5, 0 * SIZE(X)
  252. addq X, INCX, X
  253. LD x6, 0 * SIZE(X)
  254. addq X, INCX, X
  255. lda I, -1(I)
  256. ble I, $L22
  257. .align 4
  258. $L21:
  259. addt a0, t0, a0
  260. LD x7, 0 * SIZE(X)
  261. mult x0, x0, t0
  262. addq X, INCX, X
  263. addt a1, t1, a1
  264. LD x0, 0 * SIZE(X)
  265. mult x1, x1, t1
  266. addq X, INCX, X
  267. addt a2, t2, a2
  268. LD x1, 0 * SIZE(X)
  269. mult x2, x2, t2
  270. addq X, INCX, X
  271. addt a3, t3, a3
  272. LD x2, 0 * SIZE(X)
  273. mult x3, x3, t3
  274. addq X, INCX, X
  275. addt a0, t0, a0
  276. LD x3, 0 * SIZE(X)
  277. mult x4, x4, t0
  278. addq X, INCX, X
  279. addt a1, t1, a1
  280. LD x4, 0 * SIZE(X)
  281. mult x5, x5, t1
  282. addq X, INCX, X
  283. addt a2, t2, a2
  284. LD x5, 0 * SIZE(X)
  285. mult x6, x6, t2
  286. addq X, INCX, X
  287. addt a3, t3, a3
  288. LD x6, 0 * SIZE(X)
  289. mult x7, x7, t3
  290. addq X, INCX, X
  291. lda I, -1(I)
  292. bgt I, $L21
  293. .align 4
  294. $L22:
  295. addt a0, t0, a0
  296. LD x7, 0 * SIZE(X)
  297. mult x0, x0, t0
  298. addq X, INCX, X
  299. addt a1, t1, a1
  300. unop
  301. mult x1, x1, t1
  302. unop
  303. addt a2, t2, a2
  304. mult x2, x2, t2
  305. addt a3, t3, a3
  306. mult x3, x3, t3
  307. addt a0, t0, a0
  308. mult x4, x4, t0
  309. addt a1, t1, a1
  310. mult x5, x5, t1
  311. addt a2, t2, a2
  312. mult x6, x6, t2
  313. addt a3, t3, a3
  314. mult x7, x7, t3
  315. addt a1, t1, a1
  316. addt a2, t2, a2
  317. addt a3, t3, a3
  318. .align 4
  319. $L25:
  320. and N, 7, I
  321. ble I, $L998
  322. .align 4
  323. $L26:
  324. LD x0, 0 * SIZE(X)
  325. addq X, INCX, X
  326. addt a0, t0, a0
  327. mult x0, x0, t0
  328. lda I, -1(I)
  329. bgt I, $L26
  330. .align 4
  331. $L998:
  332. addt a0, t0, a0
  333. addt a0, a1, a0
  334. addt a2, a3, a2
  335. #if defined(EV4) || defined(EV5)
  336. addt a0, a2, $f16
  337. jsr $26, ($27), sqrt !lituse_jsr!2
  338. ldah $29, 0($26) !gpdisp!3
  339. lda $29, 0($29) !gpdisp!3
  340. #else
  341. addt a0, a2, a0
  342. sqrtt a0, a0
  343. #endif
  344. .align 4
  345. $L999:
  346. #if defined(EV4) || defined(EV5)
  347. ldq $26, 0($sp)
  348. lda $sp, 16($sp)
  349. #endif
  350. ret
  351. EPILOGUE