U1memcpy.S 17 KB

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