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.

snrm2.S 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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 N %i0
  41. #define X %i1
  42. #define INCX %i2
  43. #define I %i3
  44. #define c1 %f0
  45. #define c2 %f2
  46. #define c3 %f4
  47. #define c4 %f6
  48. #define t1 %f8
  49. #define t2 %f10
  50. #define t3 %f12
  51. #define t4 %f14
  52. #define a1 %f16
  53. #define a2 %f18
  54. #define a3 %f20
  55. #define a4 %f22
  56. #define a5 %f24
  57. #define a6 %f26
  58. #define a7 %f28
  59. #define a8 %f30
  60. PROLOGUE
  61. SAVESP
  62. FCLR(0)
  63. FMOV c1, c2
  64. FMOV c1, c3
  65. FMOV c1, c4
  66. FMOV c1, t1
  67. FMOV c1, t2
  68. FMOV c1, t3
  69. FMOV c1, t4
  70. cmp INCX, 0
  71. beq .LL20
  72. sll INCX, BASE_SHIFT, INCX
  73. cmp N, 0
  74. ble .LL20
  75. nop
  76. cmp INCX, SIZE
  77. bne .LL50
  78. nop
  79. sra N, 3, I
  80. cmp I, 0
  81. ble,pn %icc, .LL15
  82. nop
  83. ld [X + 0 * SIZE], a1
  84. add I, -1, I
  85. ld [X + 1 * SIZE], a2
  86. cmp I, 0
  87. ld [X + 2 * SIZE], a3
  88. ld [X + 3 * SIZE], a4
  89. ld [X + 4 * SIZE], a5
  90. ld [X + 5 * SIZE], a6
  91. ld [X + 6 * SIZE], a7
  92. ld [X + 7 * SIZE], a8
  93. ble,pt %icc, .LL12
  94. add X, 8 * SIZE, X
  95. #define PREFETCHSIZE 40
  96. .LL11:
  97. faddd c1, t1, c1
  98. fsmuld a1, a1, t1
  99. prefetch [X + PREFETCHSIZE * SIZE], 0
  100. faddd c2, t2, c2
  101. add I, -1, I
  102. fsmuld a2, a2, t2
  103. ld [X + 0 * SIZE], a1
  104. faddd c3, t3, c3
  105. cmp I, 0
  106. fsmuld a3, a3, t3
  107. ld [X + 1 * SIZE], a2
  108. faddd c4, t4, c4
  109. fsmuld a4, a4, t4
  110. ld [X + 2 * SIZE], a3
  111. faddd c1, t1, c1
  112. fsmuld a5, a5, t1
  113. ld [X + 3 * SIZE], a4
  114. faddd c2, t2, c2
  115. fsmuld a6, a6, t2
  116. ld [X + 4 * SIZE], a5
  117. faddd c3, t3, c3
  118. fsmuld a7, a7, t3
  119. ld [X + 5 * SIZE], a6
  120. faddd c4, t4, c4
  121. ld [X + 6 * SIZE], a7
  122. fsmuld a8, a8, t4
  123. add X, 8 * SIZE, X
  124. bg,pt %icc, .LL11
  125. ld [X - 1 * SIZE], a8
  126. .LL12:
  127. faddd c1, t1, c1
  128. fsmuld a1, a1, t1
  129. faddd c2, t2, c2
  130. fsmuld a2, a2, t2
  131. faddd c3, t3, c3
  132. fsmuld a3, a3, t3
  133. faddd c4, t4, c4
  134. fsmuld a4, a4, t4
  135. faddd c1, t1, c1
  136. fsmuld a5, a5, t1
  137. faddd c2, t2, c2
  138. fsmuld a6, a6, t2
  139. faddd c3, t3, c3
  140. fsmuld a7, a7, t3
  141. faddd c4, t4, c4
  142. fsmuld a8, a8, t4
  143. .LL15:
  144. and N, 7, I
  145. cmp I, 0
  146. ble,a,pn %icc, .LL19
  147. nop
  148. .LL16:
  149. ld [X + 0 * SIZE], a1
  150. add I, -1, I
  151. cmp I, 0
  152. faddd c1, t1, c1
  153. fsmuld a1, a1, t1
  154. bg,pt %icc, .LL16
  155. add X, 1 * SIZE, X
  156. .LL19:
  157. faddd c1, t1, c1
  158. faddd c2, t2, c2
  159. faddd c3, t3, c3
  160. faddd c4, t4, c4
  161. faddd c1, c2, c1
  162. faddd c3, c4, c3
  163. faddd c1, c3, c1
  164. fsqrtd c1, c1
  165. #if !defined(NEED_F2CCONV) || !defined(F_INTERFACE_F2C)
  166. fdtos c1, c1
  167. #endif
  168. .LL20:
  169. return %i7 + 8
  170. clr %g0
  171. .LL50:
  172. sra N, 3, I
  173. cmp I, 0
  174. ble,pn %icc, .LL55
  175. nop
  176. ld [X + 0 * SIZE], a1
  177. add X, INCX, X
  178. ld [X + 0 * SIZE], a2
  179. add X, INCX, X
  180. ld [X + 0 * SIZE], a3
  181. add X, INCX, X
  182. ld [X + 0 * SIZE], a4
  183. add X, INCX, X
  184. ld [X + 0 * SIZE], a5
  185. add X, INCX, X
  186. ld [X + 0 * SIZE], a6
  187. add X, INCX, X
  188. add I, -1, I
  189. ld [X + 0 * SIZE], a7
  190. cmp I, 0
  191. add X, INCX, X
  192. ld [X + 0 * SIZE], a8
  193. ble,pt %icc, .LL52
  194. add X, INCX, X
  195. .LL51:
  196. faddd c1, t1, c1
  197. add I, -1, I
  198. fsmuld a1, a1, t1
  199. ld [X + 0 * SIZE], a1
  200. add X, INCX, X
  201. faddd c2, t2, c2
  202. cmp I, 0
  203. fsmuld a2, a2, t2
  204. ld [X + 0 * SIZE], a2
  205. add X, INCX, X
  206. faddd c3, t3, c3
  207. fsmuld a3, a3, t3
  208. ld [X + 0 * SIZE], a3
  209. add X, INCX, X
  210. faddd c4, t4, c4
  211. fsmuld a4, a4, t4
  212. ld [X + 0 * SIZE], a4
  213. add X, INCX, X
  214. faddd c1, t1, c1
  215. fsmuld a5, a5, t1
  216. ld [X + 0 * SIZE], a5
  217. add X, INCX, X
  218. faddd c2, t2, c2
  219. fsmuld a6, a6, t2
  220. ld [X + 0 * SIZE], a6
  221. add X, INCX, X
  222. faddd c3, t3, c3
  223. fsmuld a7, a7, t3
  224. ld [X + 0 * SIZE], a7
  225. add X, INCX, X
  226. faddd c4, t4, c4
  227. fsmuld a8, a8, t4
  228. ld [X + 0 * SIZE], a8
  229. bg,pt %icc, .LL51
  230. add X, INCX, X
  231. .LL52:
  232. faddd c1, t1, c1
  233. fsmuld a1, a1, t1
  234. faddd c2, t2, c2
  235. fsmuld a2, a2, t2
  236. faddd c3, t3, c3
  237. fsmuld a3, a3, t3
  238. faddd c4, t4, c4
  239. fsmuld a4, a4, t4
  240. faddd c1, t1, c1
  241. fsmuld a5, a5, t1
  242. faddd c2, t2, c2
  243. fsmuld a6, a6, t2
  244. faddd c3, t3, c3
  245. fsmuld a7, a7, t3
  246. faddd c4, t4, c4
  247. fsmuld a8, a8, t4
  248. .LL55:
  249. and N, 7, I
  250. cmp I, 0
  251. ble,a,pn %icc, .LL59
  252. nop
  253. .LL56:
  254. ld [X + 0 * SIZE], a1
  255. add I, -1, I
  256. cmp I, 0
  257. faddd c1, t1, c1
  258. fsmuld a1, a1, t1
  259. bg,pt %icc, .LL56
  260. add X, INCX, X
  261. .LL59:
  262. faddd c1, t1, c1
  263. faddd c2, t2, c2
  264. faddd c3, t3, c3
  265. faddd c4, t4, c4
  266. faddd c1, c2, c1
  267. faddd c3, c4, c3
  268. faddd c1, c3, c1
  269. fsqrtd c1, c1
  270. #if !defined(NEED_F2CCONV) || !defined(F_INTERFACE_F2C)
  271. fdtos c1, c1
  272. #endif
  273. return %i7 + 8
  274. clr %o0
  275. EPILOGUE