U1memcpy.S 17 KB

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