U1memcpy.S 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. /* U1memcpy.S: UltraSPARC-I/II/IIi/IIe optimized memcpy.
  2. *
  3. * Copyright (C) 1997, 2004 David S. Miller (davem@redhat.com)
  4. * Copyright (C) 1996, 1997, 1998, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  5. */
  6. #ifdef __KERNEL__
  7. #include <linux/linkage.h>
  8. #include <asm/visasm.h>
  9. #include <asm/asi.h>
  10. #define GLOBAL_SPARE g7
  11. #else
  12. #define GLOBAL_SPARE g5
  13. #define ASI_BLK_P 0xf0
  14. #define FPRS_FEF 0x04
  15. #ifdef MEMCPY_DEBUG
  16. #define VISEntry rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \
  17. clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0;
  18. #define VISExit and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
  19. #else
  20. #define VISEntry rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs
  21. #define VISExit and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
  22. #endif
  23. #endif
  24. #ifndef EX_LD
  25. #define EX_LD(x,y) x
  26. #endif
  27. #ifndef EX_LD_FP
  28. #define EX_LD_FP(x,y) x
  29. #endif
  30. #ifndef EX_ST
  31. #define EX_ST(x,y) x
  32. #endif
  33. #ifndef EX_ST_FP
  34. #define EX_ST_FP(x,y) x
  35. #endif
  36. #ifndef LOAD
  37. #define LOAD(type,addr,dest) type [addr], dest
  38. #endif
  39. #ifndef LOAD_BLK
  40. #define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_P, dest
  41. #endif
  42. #ifndef STORE
  43. #define STORE(type,src,addr) type src, [addr]
  44. #endif
  45. #ifndef STORE_BLK
  46. #define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_P
  47. #endif
  48. #ifndef FUNC_NAME
  49. #define FUNC_NAME memcpy
  50. #endif
  51. #ifndef PREAMBLE
  52. #define PREAMBLE
  53. #endif
  54. #ifndef XCC
  55. #define XCC xcc
  56. #endif
  57. #define FREG_FROB(f1, f2, f3, f4, f5, f6, f7, f8, f9) \
  58. faligndata %f1, %f2, %f48; \
  59. faligndata %f2, %f3, %f50; \
  60. faligndata %f3, %f4, %f52; \
  61. faligndata %f4, %f5, %f54; \
  62. faligndata %f5, %f6, %f56; \
  63. faligndata %f6, %f7, %f58; \
  64. faligndata %f7, %f8, %f60; \
  65. faligndata %f8, %f9, %f62;
  66. #define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, jmptgt) \
  67. EX_LD_FP(LOAD_BLK(%src, %fdest), U1_gs_80_fp); \
  68. EX_ST_FP(STORE_BLK(%fsrc, %dest), U1_gs_80_fp); \
  69. add %src, 0x40, %src; \
  70. subcc %GLOBAL_SPARE, 0x40, %GLOBAL_SPARE; \
  71. be,pn %xcc, jmptgt; \
  72. add %dest, 0x40, %dest; \
  73. #define LOOP_CHUNK1(src, dest, branch_dest) \
  74. MAIN_LOOP_CHUNK(src, dest, f0, f48, branch_dest)
  75. #define LOOP_CHUNK2(src, dest, branch_dest) \
  76. MAIN_LOOP_CHUNK(src, dest, f16, f48, branch_dest)
  77. #define LOOP_CHUNK3(src, dest, branch_dest) \
  78. MAIN_LOOP_CHUNK(src, dest, f32, f48, branch_dest)
  79. #define DO_SYNC membar #Sync;
  80. #define STORE_SYNC(dest, fsrc) \
  81. EX_ST_FP(STORE_BLK(%fsrc, %dest), U1_gs_80_fp); \
  82. add %dest, 0x40, %dest; \
  83. DO_SYNC
  84. #define STORE_JUMP(dest, fsrc, target) \
  85. EX_ST_FP(STORE_BLK(%fsrc, %dest), U1_gs_40_fp); \
  86. add %dest, 0x40, %dest; \
  87. ba,pt %xcc, target; \
  88. nop;
  89. #define FINISH_VISCHUNK(dest, f0, f1) \
  90. subcc %g3, 8, %g3; \
  91. bl,pn %xcc, 95f; \
  92. faligndata %f0, %f1, %f48; \
  93. EX_ST_FP(STORE(std, %f48, %dest), U1_g3_8_fp); \
  94. add %dest, 8, %dest;
  95. #define UNEVEN_VISCHUNK_LAST(dest, f0, f1) \
  96. subcc %g3, 8, %g3; \
  97. bl,pn %xcc, 95f; \
  98. fsrc2 %f0, %f1;
  99. #define UNEVEN_VISCHUNK(dest, f0, f1) \
  100. UNEVEN_VISCHUNK_LAST(dest, f0, f1) \
  101. ba,a,pt %xcc, 93f;
  102. .register %g2,#scratch
  103. .register %g3,#scratch
  104. .text
  105. #ifndef EX_RETVAL
  106. #define EX_RETVAL(x) x
  107. ENTRY(U1_g1_1_fp)
  108. VISExitHalf
  109. add %g1, 1, %g1
  110. add %g1, %g2, %g1
  111. retl
  112. add %g1, %o2, %o0
  113. ENDPROC(U1_g1_1_fp)
  114. ENTRY(U1_g2_0_fp)
  115. VISExitHalf
  116. retl
  117. add %g2, %o2, %o0
  118. ENDPROC(U1_g2_0_fp)
  119. ENTRY(U1_g2_8_fp)
  120. VISExitHalf
  121. add %g2, 8, %g2
  122. retl
  123. add %g2, %o2, %o0
  124. ENDPROC(U1_g2_8_fp)
  125. ENTRY(U1_gs_0_fp)
  126. VISExitHalf
  127. add %GLOBAL_SPARE, %g3, %o0
  128. retl
  129. add %o0, %o2, %o0
  130. ENDPROC(U1_gs_0_fp)
  131. ENTRY(U1_gs_80_fp)
  132. VISExitHalf
  133. add %GLOBAL_SPARE, 0x80, %GLOBAL_SPARE
  134. add %GLOBAL_SPARE, %g3, %o0
  135. retl
  136. add %o0, %o2, %o0
  137. ENDPROC(U1_gs_80_fp)
  138. ENTRY(U1_gs_40_fp)
  139. VISExitHalf
  140. add %GLOBAL_SPARE, 0x40, %GLOBAL_SPARE
  141. add %GLOBAL_SPARE, %g3, %o0
  142. retl
  143. add %o0, %o2, %o0
  144. ENDPROC(U1_gs_40_fp)
  145. ENTRY(U1_g3_0_fp)
  146. VISExitHalf
  147. retl
  148. add %g3, %o2, %o0
  149. ENDPROC(U1_g3_0_fp)
  150. ENTRY(U1_g3_8_fp)
  151. VISExitHalf
  152. add %g3, 8, %g3
  153. retl
  154. add %g3, %o2, %o0
  155. ENDPROC(U1_g3_8_fp)
  156. ENTRY(U1_o2_0_fp)
  157. VISExitHalf
  158. retl
  159. mov %o2, %o0
  160. ENDPROC(U1_o2_0_fp)
  161. ENTRY(U1_o2_1_fp)
  162. VISExitHalf
  163. retl
  164. add %o2, 1, %o0
  165. ENDPROC(U1_o2_1_fp)
  166. ENTRY(U1_gs_0)
  167. VISExitHalf
  168. retl
  169. add %GLOBAL_SPARE, %o2, %o0
  170. ENDPROC(U1_gs_0)
  171. ENTRY(U1_gs_8)
  172. VISExitHalf
  173. add %GLOBAL_SPARE, %o2, %GLOBAL_SPARE
  174. retl
  175. add %GLOBAL_SPARE, 0x8, %o0
  176. ENDPROC(U1_gs_8)
  177. ENTRY(U1_gs_10)
  178. VISExitHalf
  179. add %GLOBAL_SPARE, %o2, %GLOBAL_SPARE
  180. retl
  181. add %GLOBAL_SPARE, 0x10, %o0
  182. ENDPROC(U1_gs_10)
  183. ENTRY(U1_o2_0)
  184. retl
  185. mov %o2, %o0
  186. ENDPROC(U1_o2_0)
  187. ENTRY(U1_o2_8)
  188. retl
  189. add %o2, 8, %o0
  190. ENDPROC(U1_o2_8)
  191. ENTRY(U1_o2_4)
  192. retl
  193. add %o2, 4, %o0
  194. ENDPROC(U1_o2_4)
  195. ENTRY(U1_o2_1)
  196. retl
  197. add %o2, 1, %o0
  198. ENDPROC(U1_o2_1)
  199. ENTRY(U1_g1_0)
  200. retl
  201. add %g1, %o2, %o0
  202. ENDPROC(U1_g1_0)
  203. ENTRY(U1_g1_1)
  204. add %g1, 1, %g1
  205. retl
  206. add %g1, %o2, %o0
  207. ENDPROC(U1_g1_1)
  208. ENTRY(U1_gs_0_o2_adj)
  209. and %o2, 7, %o2
  210. retl
  211. add %GLOBAL_SPARE, %o2, %o0
  212. ENDPROC(U1_gs_0_o2_adj)
  213. ENTRY(U1_gs_8_o2_adj)
  214. and %o2, 7, %o2
  215. add %GLOBAL_SPARE, 8, %GLOBAL_SPARE
  216. retl
  217. add %GLOBAL_SPARE, %o2, %o0
  218. ENDPROC(U1_gs_8_o2_adj)
  219. #endif
  220. .align 64
  221. .globl FUNC_NAME
  222. .type FUNC_NAME,#function
  223. FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
  224. srlx %o2, 31, %g2
  225. cmp %g2, 0
  226. tne %xcc, 5
  227. PREAMBLE
  228. mov %o0, %o4
  229. cmp %o2, 0
  230. be,pn %XCC, 85f
  231. or %o0, %o1, %o3
  232. cmp %o2, 16
  233. blu,a,pn %XCC, 80f
  234. or %o3, %o2, %o3
  235. cmp %o2, (5 * 64)
  236. blu,pt %XCC, 70f
  237. andcc %o3, 0x7, %g0
  238. /* Clobbers o5/g1/g2/g3/g7/icc/xcc. */
  239. VISEntry
  240. /* Is 'dst' already aligned on an 64-byte boundary? */
  241. andcc %o0, 0x3f, %g2
  242. be,pt %XCC, 2f
  243. /* Compute abs((dst & 0x3f) - 0x40) into %g2. This is the number
  244. * of bytes to copy to make 'dst' 64-byte aligned. We pre-
  245. * subtract this from 'len'.
  246. */
  247. sub %o0, %o1, %GLOBAL_SPARE
  248. sub %g2, 0x40, %g2
  249. sub %g0, %g2, %g2
  250. sub %o2, %g2, %o2
  251. andcc %g2, 0x7, %g1
  252. be,pt %icc, 2f
  253. and %g2, 0x38, %g2
  254. 1: subcc %g1, 0x1, %g1
  255. EX_LD_FP(LOAD(ldub, %o1 + 0x00, %o3), U1_g1_1_fp)
  256. EX_ST_FP(STORE(stb, %o3, %o1 + %GLOBAL_SPARE), U1_g1_1_fp)
  257. bgu,pt %XCC, 1b
  258. add %o1, 0x1, %o1
  259. add %o1, %GLOBAL_SPARE, %o0
  260. 2: cmp %g2, 0x0
  261. and %o1, 0x7, %g1
  262. be,pt %icc, 3f
  263. alignaddr %o1, %g0, %o1
  264. EX_LD_FP(LOAD(ldd, %o1, %f4), U1_g2_0_fp)
  265. 1: EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f6), U1_g2_0_fp)
  266. add %o1, 0x8, %o1
  267. subcc %g2, 0x8, %g2
  268. faligndata %f4, %f6, %f0
  269. EX_ST_FP(STORE(std, %f0, %o0), U1_g2_8_fp)
  270. be,pn %icc, 3f
  271. add %o0, 0x8, %o0
  272. EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f4), U1_g2_0_fp)
  273. add %o1, 0x8, %o1
  274. subcc %g2, 0x8, %g2
  275. faligndata %f6, %f4, %f0
  276. EX_ST_FP(STORE(std, %f0, %o0), U1_g2_8_fp)
  277. bne,pt %icc, 1b
  278. add %o0, 0x8, %o0
  279. /* Destination is 64-byte aligned. */
  280. 3:
  281. membar #LoadStore | #StoreStore | #StoreLoad
  282. subcc %o2, 0x40, %GLOBAL_SPARE
  283. add %o1, %g1, %g1
  284. andncc %GLOBAL_SPARE, (0x40 - 1), %GLOBAL_SPARE
  285. srl %g1, 3, %g2
  286. sub %o2, %GLOBAL_SPARE, %g3
  287. andn %o1, (0x40 - 1), %o1
  288. and %g2, 7, %g2
  289. andncc %g3, 0x7, %g3
  290. fsrc2 %f0, %f2
  291. sub %g3, 0x8, %g3
  292. sub %o2, %GLOBAL_SPARE, %o2
  293. add %g1, %GLOBAL_SPARE, %g1
  294. subcc %o2, %g3, %o2
  295. EX_LD_FP(LOAD_BLK(%o1, %f0), U1_gs_0_fp)
  296. add %o1, 0x40, %o1
  297. add %g1, %g3, %g1
  298. EX_LD_FP(LOAD_BLK(%o1, %f16), U1_gs_0_fp)
  299. add %o1, 0x40, %o1
  300. sub %GLOBAL_SPARE, 0x80, %GLOBAL_SPARE
  301. EX_LD_FP(LOAD_BLK(%o1, %f32), U1_gs_80_fp)
  302. add %o1, 0x40, %o1
  303. /* There are 8 instances of the unrolled loop,
  304. * one for each possible alignment of the
  305. * source buffer. Each loop instance is 452
  306. * bytes.
  307. */
  308. sll %g2, 3, %o3
  309. sub %o3, %g2, %o3
  310. sllx %o3, 4, %o3
  311. add %o3, %g2, %o3
  312. sllx %o3, 2, %g2
  313. 1: rd %pc, %o3
  314. add %o3, %lo(1f - 1b), %o3
  315. jmpl %o3 + %g2, %g0
  316. nop
  317. .align 64
  318. 1: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16)
  319. LOOP_CHUNK1(o1, o0, 1f)
  320. FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32)
  321. LOOP_CHUNK2(o1, o0, 2f)
  322. FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0)
  323. LOOP_CHUNK3(o1, o0, 3f)
  324. ba,pt %xcc, 1b+4
  325. faligndata %f0, %f2, %f48
  326. 1: FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32)
  327. STORE_SYNC(o0, f48)
  328. FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0)
  329. STORE_JUMP(o0, f48, 40f)
  330. 2: FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0)
  331. STORE_SYNC(o0, f48)
  332. FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16)
  333. STORE_JUMP(o0, f48, 48f)
  334. 3: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16)
  335. STORE_SYNC(o0, f48)
  336. FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32)
  337. STORE_JUMP(o0, f48, 56f)
  338. 1: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18)
  339. LOOP_CHUNK1(o1, o0, 1f)
  340. FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34)
  341. LOOP_CHUNK2(o1, o0, 2f)
  342. FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2)
  343. LOOP_CHUNK3(o1, o0, 3f)
  344. ba,pt %xcc, 1b+4
  345. faligndata %f2, %f4, %f48
  346. 1: FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34)
  347. STORE_SYNC(o0, f48)
  348. FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2)
  349. STORE_JUMP(o0, f48, 41f)
  350. 2: FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2)
  351. STORE_SYNC(o0, f48)
  352. FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18)
  353. STORE_JUMP(o0, f48, 49f)
  354. 3: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18)
  355. STORE_SYNC(o0, f48)
  356. FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34)
  357. STORE_JUMP(o0, f48, 57f)
  358. 1: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20)
  359. LOOP_CHUNK1(o1, o0, 1f)
  360. FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36)
  361. LOOP_CHUNK2(o1, o0, 2f)
  362. FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4)
  363. LOOP_CHUNK3(o1, o0, 3f)
  364. ba,pt %xcc, 1b+4
  365. faligndata %f4, %f6, %f48
  366. 1: FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36)
  367. STORE_SYNC(o0, f48)
  368. FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4)
  369. STORE_JUMP(o0, f48, 42f)
  370. 2: FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4)
  371. STORE_SYNC(o0, f48)
  372. FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20)
  373. STORE_JUMP(o0, f48, 50f)
  374. 3: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20)
  375. STORE_SYNC(o0, f48)
  376. FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36)
  377. STORE_JUMP(o0, f48, 58f)
  378. 1: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22)
  379. LOOP_CHUNK1(o1, o0, 1f)
  380. FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38)
  381. LOOP_CHUNK2(o1, o0, 2f)
  382. FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6)
  383. LOOP_CHUNK3(o1, o0, 3f)
  384. ba,pt %xcc, 1b+4
  385. faligndata %f6, %f8, %f48
  386. 1: FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38)
  387. STORE_SYNC(o0, f48)
  388. FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6)
  389. STORE_JUMP(o0, f48, 43f)
  390. 2: FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6)
  391. STORE_SYNC(o0, f48)
  392. FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22)
  393. STORE_JUMP(o0, f48, 51f)
  394. 3: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22)
  395. STORE_SYNC(o0, f48)
  396. FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38)
  397. STORE_JUMP(o0, f48, 59f)
  398. 1: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24)
  399. LOOP_CHUNK1(o1, o0, 1f)
  400. FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40)
  401. LOOP_CHUNK2(o1, o0, 2f)
  402. FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8)
  403. LOOP_CHUNK3(o1, o0, 3f)
  404. ba,pt %xcc, 1b+4
  405. faligndata %f8, %f10, %f48
  406. 1: FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40)
  407. STORE_SYNC(o0, f48)
  408. FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8)
  409. STORE_JUMP(o0, f48, 44f)
  410. 2: FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8)
  411. STORE_SYNC(o0, f48)
  412. FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24)
  413. STORE_JUMP(o0, f48, 52f)
  414. 3: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24)
  415. STORE_SYNC(o0, f48)
  416. FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40)
  417. STORE_JUMP(o0, f48, 60f)
  418. 1: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26)
  419. LOOP_CHUNK1(o1, o0, 1f)
  420. FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42)
  421. LOOP_CHUNK2(o1, o0, 2f)
  422. FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10)
  423. LOOP_CHUNK3(o1, o0, 3f)
  424. ba,pt %xcc, 1b+4
  425. faligndata %f10, %f12, %f48
  426. 1: FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42)
  427. STORE_SYNC(o0, f48)
  428. FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10)
  429. STORE_JUMP(o0, f48, 45f)
  430. 2: FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10)
  431. STORE_SYNC(o0, f48)
  432. FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26)
  433. STORE_JUMP(o0, f48, 53f)
  434. 3: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26)
  435. STORE_SYNC(o0, f48)
  436. FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42)
  437. STORE_JUMP(o0, f48, 61f)
  438. 1: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28)
  439. LOOP_CHUNK1(o1, o0, 1f)
  440. FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44)
  441. LOOP_CHUNK2(o1, o0, 2f)
  442. FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12)
  443. LOOP_CHUNK3(o1, o0, 3f)
  444. ba,pt %xcc, 1b+4
  445. faligndata %f12, %f14, %f48
  446. 1: FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44)
  447. STORE_SYNC(o0, f48)
  448. FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12)
  449. STORE_JUMP(o0, f48, 46f)
  450. 2: FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12)
  451. STORE_SYNC(o0, f48)
  452. FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28)
  453. STORE_JUMP(o0, f48, 54f)
  454. 3: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28)
  455. STORE_SYNC(o0, f48)
  456. FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44)
  457. STORE_JUMP(o0, f48, 62f)
  458. 1: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30)
  459. LOOP_CHUNK1(o1, o0, 1f)
  460. FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46)
  461. LOOP_CHUNK2(o1, o0, 2f)
  462. FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14)
  463. LOOP_CHUNK3(o1, o0, 3f)
  464. ba,pt %xcc, 1b+4
  465. faligndata %f14, %f16, %f48
  466. 1: FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46)
  467. STORE_SYNC(o0, f48)
  468. FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14)
  469. STORE_JUMP(o0, f48, 47f)
  470. 2: FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14)
  471. STORE_SYNC(o0, f48)
  472. FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30)
  473. STORE_JUMP(o0, f48, 55f)
  474. 3: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30)
  475. STORE_SYNC(o0, f48)
  476. FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46)
  477. STORE_JUMP(o0, f48, 63f)
  478. 40: FINISH_VISCHUNK(o0, f0, f2)
  479. 41: FINISH_VISCHUNK(o0, f2, f4)
  480. 42: FINISH_VISCHUNK(o0, f4, f6)
  481. 43: FINISH_VISCHUNK(o0, f6, f8)
  482. 44: FINISH_VISCHUNK(o0, f8, f10)
  483. 45: FINISH_VISCHUNK(o0, f10, f12)
  484. 46: FINISH_VISCHUNK(o0, f12, f14)
  485. 47: UNEVEN_VISCHUNK(o0, f14, f0)
  486. 48: FINISH_VISCHUNK(o0, f16, f18)
  487. 49: FINISH_VISCHUNK(o0, f18, f20)
  488. 50: FINISH_VISCHUNK(o0, f20, f22)
  489. 51: FINISH_VISCHUNK(o0, f22, f24)
  490. 52: FINISH_VISCHUNK(o0, f24, f26)
  491. 53: FINISH_VISCHUNK(o0, f26, f28)
  492. 54: FINISH_VISCHUNK(o0, f28, f30)
  493. 55: UNEVEN_VISCHUNK(o0, f30, f0)
  494. 56: FINISH_VISCHUNK(o0, f32, f34)
  495. 57: FINISH_VISCHUNK(o0, f34, f36)
  496. 58: FINISH_VISCHUNK(o0, f36, f38)
  497. 59: FINISH_VISCHUNK(o0, f38, f40)
  498. 60: FINISH_VISCHUNK(o0, f40, f42)
  499. 61: FINISH_VISCHUNK(o0, f42, f44)
  500. 62: FINISH_VISCHUNK(o0, f44, f46)
  501. 63: UNEVEN_VISCHUNK_LAST(o0, f46, f0)
  502. 93: EX_LD_FP(LOAD(ldd, %o1, %f2), U1_g3_0_fp)
  503. add %o1, 8, %o1
  504. subcc %g3, 8, %g3
  505. faligndata %f0, %f2, %f8
  506. EX_ST_FP(STORE(std, %f8, %o0), U1_g3_8_fp)
  507. bl,pn %xcc, 95f
  508. add %o0, 8, %o0
  509. EX_LD_FP(LOAD(ldd, %o1, %f0), U1_g3_0_fp)
  510. add %o1, 8, %o1
  511. subcc %g3, 8, %g3
  512. faligndata %f2, %f0, %f8
  513. EX_ST_FP(STORE(std, %f8, %o0), U1_g3_8_fp)
  514. bge,pt %xcc, 93b
  515. add %o0, 8, %o0
  516. 95: brz,pt %o2, 2f
  517. mov %g1, %o1
  518. 1: EX_LD_FP(LOAD(ldub, %o1, %o3), U1_o2_0_fp)
  519. add %o1, 1, %o1
  520. subcc %o2, 1, %o2
  521. EX_ST_FP(STORE(stb, %o3, %o0), U1_o2_1_fp)
  522. bne,pt %xcc, 1b
  523. add %o0, 1, %o0
  524. 2: membar #StoreLoad | #StoreStore
  525. VISExit
  526. retl
  527. mov EX_RETVAL(%o4), %o0
  528. .align 64
  529. 70: /* 16 < len <= (5 * 64) */
  530. bne,pn %XCC, 75f
  531. sub %o0, %o1, %o3
  532. 72: andn %o2, 0xf, %GLOBAL_SPARE
  533. and %o2, 0xf, %o2
  534. 1: EX_LD(LOAD(ldx, %o1 + 0x00, %o5), U1_gs_0)
  535. EX_LD(LOAD(ldx, %o1 + 0x08, %g1), U1_gs_0)
  536. subcc %GLOBAL_SPARE, 0x10, %GLOBAL_SPARE
  537. EX_ST(STORE(stx, %o5, %o1 + %o3), U1_gs_10)
  538. add %o1, 0x8, %o1
  539. EX_ST(STORE(stx, %g1, %o1 + %o3), U1_gs_8)
  540. bgu,pt %XCC, 1b
  541. add %o1, 0x8, %o1
  542. 73: andcc %o2, 0x8, %g0
  543. be,pt %XCC, 1f
  544. nop
  545. EX_LD(LOAD(ldx, %o1, %o5), U1_o2_0)
  546. sub %o2, 0x8, %o2
  547. EX_ST(STORE(stx, %o5, %o1 + %o3), U1_o2_8)
  548. add %o1, 0x8, %o1
  549. 1: andcc %o2, 0x4, %g0
  550. be,pt %XCC, 1f
  551. nop
  552. EX_LD(LOAD(lduw, %o1, %o5), U1_o2_0)
  553. sub %o2, 0x4, %o2
  554. EX_ST(STORE(stw, %o5, %o1 + %o3), U1_o2_4)
  555. add %o1, 0x4, %o1
  556. 1: cmp %o2, 0
  557. be,pt %XCC, 85f
  558. nop
  559. ba,pt %xcc, 90f
  560. nop
  561. 75: andcc %o0, 0x7, %g1
  562. sub %g1, 0x8, %g1
  563. be,pn %icc, 2f
  564. sub %g0, %g1, %g1
  565. sub %o2, %g1, %o2
  566. 1: EX_LD(LOAD(ldub, %o1, %o5), U1_g1_0)
  567. subcc %g1, 1, %g1
  568. EX_ST(STORE(stb, %o5, %o1 + %o3), U1_g1_1)
  569. bgu,pt %icc, 1b
  570. add %o1, 1, %o1
  571. 2: add %o1, %o3, %o0
  572. andcc %o1, 0x7, %g1
  573. bne,pt %icc, 8f
  574. sll %g1, 3, %g1
  575. cmp %o2, 16
  576. bgeu,pt %icc, 72b
  577. nop
  578. ba,a,pt %xcc, 73b
  579. 8: mov 64, %o3
  580. andn %o1, 0x7, %o1
  581. EX_LD(LOAD(ldx, %o1, %g2), U1_o2_0)
  582. sub %o3, %g1, %o3
  583. andn %o2, 0x7, %GLOBAL_SPARE
  584. sllx %g2, %g1, %g2
  585. 1: EX_LD(LOAD(ldx, %o1 + 0x8, %g3), U1_gs_0_o2_adj)
  586. subcc %GLOBAL_SPARE, 0x8, %GLOBAL_SPARE
  587. add %o1, 0x8, %o1
  588. srlx %g3, %o3, %o5
  589. or %o5, %g2, %o5
  590. EX_ST(STORE(stx, %o5, %o0), U1_gs_8_o2_adj)
  591. add %o0, 0x8, %o0
  592. bgu,pt %icc, 1b
  593. sllx %g3, %g1, %g2
  594. srl %g1, 3, %g1
  595. andcc %o2, 0x7, %o2
  596. be,pn %icc, 85f
  597. add %o1, %g1, %o1
  598. ba,pt %xcc, 90f
  599. sub %o0, %o1, %o3
  600. .align 64
  601. 80: /* 0 < len <= 16 */
  602. andcc %o3, 0x3, %g0
  603. bne,pn %XCC, 90f
  604. sub %o0, %o1, %o3
  605. 1: EX_LD(LOAD(lduw, %o1, %g1), U1_o2_0)
  606. subcc %o2, 4, %o2
  607. EX_ST(STORE(stw, %g1, %o1 + %o3), U1_o2_4)
  608. bgu,pt %XCC, 1b
  609. add %o1, 4, %o1
  610. 85: retl
  611. mov EX_RETVAL(%o4), %o0
  612. .align 32
  613. 90: EX_LD(LOAD(ldub, %o1, %g1), U1_o2_0)
  614. subcc %o2, 1, %o2
  615. EX_ST(STORE(stb, %g1, %o1 + %o3), U1_o2_1)
  616. bgu,pt %XCC, 90b
  617. add %o1, 1, %o1
  618. retl
  619. mov EX_RETVAL(%o4), %o0
  620. .size FUNC_NAME, .-FUNC_NAME