memcpy.S 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. /* Copy SIZE bytes from SRC to DEST.
  2. For UltraSPARC.
  3. Copyright (C) 1996, 97, 98, 99, 2003 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. Contributed by David S. Miller (davem@caip.rutgers.edu) and
  6. Jakub Jelinek (jakub@redhat.com).
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library; if not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #include <features.h>
  19. #include <asm/asi.h>
  20. #ifndef XCC
  21. #define USE_BPR
  22. .register %g2, #scratch
  23. .register %g3, #scratch
  24. .register %g6, #scratch
  25. #define XCC xcc
  26. #endif
  27. #define FPRS_FEF 4
  28. #define FREG_FROB(f1, f2, f3, f4, f5, f6, f7, f8, f9) \
  29. faligndata %f1, %f2, %f48; \
  30. faligndata %f2, %f3, %f50; \
  31. faligndata %f3, %f4, %f52; \
  32. faligndata %f4, %f5, %f54; \
  33. faligndata %f5, %f6, %f56; \
  34. faligndata %f6, %f7, %f58; \
  35. faligndata %f7, %f8, %f60; \
  36. faligndata %f8, %f9, %f62;
  37. #define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, len, jmptgt) \
  38. ldda [%src] %asi, %fdest; \
  39. add %src, 0x40, %src; \
  40. add %dest, 0x40, %dest; \
  41. subcc %len, 0x40, %len; \
  42. be,pn %xcc, jmptgt; \
  43. stda %fsrc, [%dest - 0x40] %asi;
  44. #define LOOP_CHUNK1(src, dest, len, branch_dest) \
  45. MAIN_LOOP_CHUNK(src, dest, f0, f48, len, branch_dest)
  46. #define LOOP_CHUNK2(src, dest, len, branch_dest) \
  47. MAIN_LOOP_CHUNK(src, dest, f16, f48, len, branch_dest)
  48. #define LOOP_CHUNK3(src, dest, len, branch_dest) \
  49. MAIN_LOOP_CHUNK(src, dest, f32, f48, len, branch_dest)
  50. #define STORE_SYNC(dest, fsrc) \
  51. stda %fsrc, [%dest] %asi; \
  52. add %dest, 0x40, %dest;
  53. #define STORE_JUMP(dest, fsrc, target) \
  54. stda %fsrc, [%dest] %asi; \
  55. add %dest, 0x40, %dest; \
  56. ba,pt %xcc, target;
  57. #define VISLOOP_PAD nop; nop; nop; nop; \
  58. nop; nop; nop; nop; \
  59. nop; nop; nop; nop; \
  60. nop; nop; nop;
  61. #define FINISH_VISCHUNK(dest, f0, f1, left) \
  62. subcc %left, 8, %left; \
  63. bl,pn %xcc, 205f; \
  64. faligndata %f0, %f1, %f48; \
  65. std %f48, [%dest]; \
  66. add %dest, 8, %dest;
  67. #define UNEVEN_VISCHUNK(dest, f0, f1, left) \
  68. subcc %left, 8, %left; \
  69. bl,pn %xcc, 205f; \
  70. fsrc1 %f0, %f1; \
  71. ba,a,pt %xcc, 204f;
  72. /* Macros for non-VIS memcpy code. */
  73. #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \
  74. ldx [%src + offset + 0x00], %t0; \
  75. ldx [%src + offset + 0x08], %t1; \
  76. ldx [%src + offset + 0x10], %t2; \
  77. ldx [%src + offset + 0x18], %t3; \
  78. stw %t0, [%dst + offset + 0x04]; \
  79. srlx %t0, 32, %t0; \
  80. stw %t0, [%dst + offset + 0x00]; \
  81. stw %t1, [%dst + offset + 0x0c]; \
  82. srlx %t1, 32, %t1; \
  83. stw %t1, [%dst + offset + 0x08]; \
  84. stw %t2, [%dst + offset + 0x14]; \
  85. srlx %t2, 32, %t2; \
  86. stw %t2, [%dst + offset + 0x10]; \
  87. stw %t3, [%dst + offset + 0x1c]; \
  88. srlx %t3, 32, %t3; \
  89. stw %t3, [%dst + offset + 0x18];
  90. #define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
  91. ldx [%src + offset + 0x00], %t0; \
  92. ldx [%src + offset + 0x08], %t1; \
  93. ldx [%src + offset + 0x10], %t2; \
  94. ldx [%src + offset + 0x18], %t3; \
  95. stx %t0, [%dst + offset + 0x00]; \
  96. stx %t1, [%dst + offset + 0x08]; \
  97. stx %t2, [%dst + offset + 0x10]; \
  98. stx %t3, [%dst + offset + 0x18]; \
  99. ldx [%src + offset + 0x20], %t0; \
  100. ldx [%src + offset + 0x28], %t1; \
  101. ldx [%src + offset + 0x30], %t2; \
  102. ldx [%src + offset + 0x38], %t3; \
  103. stx %t0, [%dst + offset + 0x20]; \
  104. stx %t1, [%dst + offset + 0x28]; \
  105. stx %t2, [%dst + offset + 0x30]; \
  106. stx %t3, [%dst + offset + 0x38];
  107. #define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
  108. ldx [%src - offset - 0x10], %t0; \
  109. ldx [%src - offset - 0x08], %t1; \
  110. stw %t0, [%dst - offset - 0x0c]; \
  111. srlx %t0, 32, %t2; \
  112. stw %t2, [%dst - offset - 0x10]; \
  113. stw %t1, [%dst - offset - 0x04]; \
  114. srlx %t1, 32, %t3; \
  115. stw %t3, [%dst - offset - 0x08];
  116. #define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \
  117. ldx [%src - offset - 0x10], %t0; \
  118. ldx [%src - offset - 0x08], %t1; \
  119. stx %t0, [%dst - offset - 0x10]; \
  120. stx %t1, [%dst - offset - 0x08];
  121. /* Macros for non-VIS memmove code. */
  122. #define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \
  123. ldx [%src - offset - 0x20], %t0; \
  124. ldx [%src - offset - 0x18], %t1; \
  125. ldx [%src - offset - 0x10], %t2; \
  126. ldx [%src - offset - 0x08], %t3; \
  127. stw %t0, [%dst - offset - 0x1c]; \
  128. srlx %t0, 32, %t0; \
  129. stw %t0, [%dst - offset - 0x20]; \
  130. stw %t1, [%dst - offset - 0x14]; \
  131. srlx %t1, 32, %t1; \
  132. stw %t1, [%dst - offset - 0x18]; \
  133. stw %t2, [%dst - offset - 0x0c]; \
  134. srlx %t2, 32, %t2; \
  135. stw %t2, [%dst - offset - 0x10]; \
  136. stw %t3, [%dst - offset - 0x04]; \
  137. srlx %t3, 32, %t3; \
  138. stw %t3, [%dst - offset - 0x08];
  139. #define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
  140. ldx [%src - offset - 0x20], %t0; \
  141. ldx [%src - offset - 0x18], %t1; \
  142. ldx [%src - offset - 0x10], %t2; \
  143. ldx [%src - offset - 0x08], %t3; \
  144. stx %t0, [%dst - offset - 0x20]; \
  145. stx %t1, [%dst - offset - 0x18]; \
  146. stx %t2, [%dst - offset - 0x10]; \
  147. stx %t3, [%dst - offset - 0x08]; \
  148. ldx [%src - offset - 0x40], %t0; \
  149. ldx [%src - offset - 0x38], %t1; \
  150. ldx [%src - offset - 0x30], %t2; \
  151. ldx [%src - offset - 0x28], %t3; \
  152. stx %t0, [%dst - offset - 0x40]; \
  153. stx %t1, [%dst - offset - 0x38]; \
  154. stx %t2, [%dst - offset - 0x30]; \
  155. stx %t3, [%dst - offset - 0x28];
  156. #define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
  157. ldx [%src + offset + 0x00], %t0; \
  158. ldx [%src + offset + 0x08], %t1; \
  159. stw %t0, [%dst + offset + 0x04]; \
  160. srlx %t0, 32, %t2; \
  161. stw %t2, [%dst + offset + 0x00]; \
  162. stw %t1, [%dst + offset + 0x0c]; \
  163. srlx %t1, 32, %t3; \
  164. stw %t3, [%dst + offset + 0x08];
  165. #define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \
  166. ldx [%src + offset + 0x00], %t0; \
  167. ldx [%src + offset + 0x08], %t1; \
  168. stx %t0, [%dst + offset + 0x00]; \
  169. stx %t1, [%dst + offset + 0x08];
  170. .text
  171. .align 32
  172. #ifdef __UCLIBC_SUSV3_LEGACY__
  173. ENTRY(bcopy)
  174. sub %o1, %o0, %o4 /* IEU0 Group */
  175. mov %o0, %g3 /* IEU1 */
  176. cmp %o4, %o2 /* IEU1 Group */
  177. mov %o1, %o0 /* IEU0 */
  178. bgeu,pt %XCC, 210f /* CTI */
  179. mov %g3, %o1 /* IEU0 Group */
  180. #ifndef USE_BPR
  181. srl %o2, 0, %o2 /* IEU1 */
  182. #endif
  183. brnz,pn %o2, 220f /* CTI Group */
  184. add %o0, %o2, %o0 /* IEU0 */
  185. retl
  186. nop
  187. END(bcopy)
  188. #endif
  189. .align 32
  190. 200: be,pt %xcc, 201f /* CTI */
  191. andcc %o0, 0x38, %g5 /* IEU1 Group */
  192. mov 8, %g1 /* IEU0 */
  193. sub %g1, %g2, %g2 /* IEU0 Group */
  194. andcc %o0, 1, %g0 /* IEU1 */
  195. be,pt %icc, 2f /* CTI */
  196. sub %o2, %g2, %o2 /* IEU0 Group */
  197. 1: ldub [%o1], %o5 /* Load Group */
  198. add %o1, 1, %o1 /* IEU0 */
  199. add %o0, 1, %o0 /* IEU1 */
  200. subcc %g2, 1, %g2 /* IEU1 Group */
  201. be,pn %xcc, 3f /* CTI */
  202. stb %o5, [%o0 - 1] /* Store */
  203. 2: ldub [%o1], %o5 /* Load Group */
  204. add %o0, 2, %o0 /* IEU0 */
  205. ldub [%o1 + 1], %g3 /* Load Group */
  206. subcc %g2, 2, %g2 /* IEU1 Group */
  207. stb %o5, [%o0 - 2] /* Store */
  208. add %o1, 2, %o1 /* IEU0 */
  209. bne,pt %xcc, 2b /* CTI Group */
  210. stb %g3, [%o0 - 1] /* Store */
  211. 3: andcc %o0, 0x38, %g5 /* IEU1 Group */
  212. 201: be,pt %icc, 202f /* CTI */
  213. mov 64, %g1 /* IEU0 */
  214. fmovd %f0, %f2 /* FPU */
  215. sub %g1, %g5, %g5 /* IEU0 Group */
  216. alignaddr %o1, %g0, %g1 /* GRU Group */
  217. ldd [%g1], %f4 /* Load Group */
  218. sub %o2, %g5, %o2 /* IEU0 */
  219. 1: ldd [%g1 + 0x8], %f6 /* Load Group */
  220. add %g1, 0x8, %g1 /* IEU0 Group */
  221. subcc %g5, 8, %g5 /* IEU1 */
  222. faligndata %f4, %f6, %f0 /* GRU Group */
  223. std %f0, [%o0] /* Store */
  224. add %o1, 8, %o1 /* IEU0 Group */
  225. be,pn %xcc, 202f /* CTI */
  226. add %o0, 8, %o0 /* IEU1 */
  227. ldd [%g1 + 0x8], %f4 /* Load Group */
  228. add %g1, 8, %g1 /* IEU0 */
  229. subcc %g5, 8, %g5 /* IEU1 */
  230. faligndata %f6, %f4, %f0 /* GRU Group */
  231. std %f0, [%o0] /* Store */
  232. add %o1, 8, %o1 /* IEU0 */
  233. bne,pt %xcc, 1b /* CTI Group */
  234. add %o0, 8, %o0 /* IEU0 */
  235. 202: membar #LoadStore | #StoreStore | #StoreLoad /* LSU Group */
  236. wr %g0, ASI_BLK_P, %asi /* LSU Group */
  237. subcc %o2, 0x40, %g6 /* IEU1 Group */
  238. mov %o1, %g1 /* IEU0 */
  239. andncc %g6, (0x40 - 1), %g6 /* IEU1 Group */
  240. srl %g1, 3, %g2 /* IEU0 */
  241. sub %o2, %g6, %g3 /* IEU0 Group */
  242. andn %o1, (0x40 - 1), %o1 /* IEU1 */
  243. and %g2, 7, %g2 /* IEU0 Group */
  244. andncc %g3, 0x7, %g3 /* IEU1 */
  245. fmovd %f0, %f2 /* FPU */
  246. sub %g3, 0x10, %g3 /* IEU0 Group */
  247. sub %o2, %g6, %o2 /* IEU1 */
  248. alignaddr %g1, %g0, %g0 /* GRU Group */
  249. add %g1, %g6, %g1 /* IEU0 Group */
  250. subcc %o2, %g3, %o2 /* IEU1 */
  251. ldda [%o1 + 0x00] %asi, %f0 /* LSU Group */
  252. add %g1, %g3, %g1 /* IEU0 */
  253. ldda [%o1 + 0x40] %asi, %f16 /* LSU Group */
  254. sub %g6, 0x80, %g6 /* IEU0 */
  255. ldda [%o1 + 0x80] %asi, %f32 /* LSU Group */
  256. /* Clk1 Group 8-( */
  257. /* Clk2 Group 8-( */
  258. /* Clk3 Group 8-( */
  259. /* Clk4 Group 8-( */
  260. 203: rd %pc, %g5 /* PDU Group 8-( */
  261. addcc %g5, %lo(300f - 203b), %g5 /* IEU1 Group */
  262. sll %g2, 9, %g2 /* IEU0 */
  263. jmpl %g5 + %g2, %g0 /* CTI Group brk forced*/
  264. addcc %o1, 0xc0, %o1 /* IEU1 Group */
  265. .align 512 /* OK, here comes the fun part... */
  266. 300: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) LOOP_CHUNK1(o1, o0, g6, 301f)
  267. FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) LOOP_CHUNK2(o1, o0, g6, 302f)
  268. FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) LOOP_CHUNK3(o1, o0, g6, 303f)
  269. b,pt %xcc, 300b+4; faligndata %f0, %f2, %f48
  270. 301: FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_SYNC(o0, f48) membar #Sync
  271. FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_JUMP(o0, f48, 400f) membar #Sync
  272. 302: FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_SYNC(o0, f48) membar #Sync
  273. FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_JUMP(o0, f48, 416f) membar #Sync
  274. 303: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_SYNC(o0, f48) membar #Sync
  275. FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_JUMP(o0, f48, 432f) membar #Sync
  276. VISLOOP_PAD
  277. 310: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) LOOP_CHUNK1(o1, o0, g6, 311f)
  278. FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) LOOP_CHUNK2(o1, o0, g6, 312f)
  279. FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) LOOP_CHUNK3(o1, o0, g6, 313f)
  280. b,pt %xcc, 310b+4; faligndata %f2, %f4, %f48
  281. 311: FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_SYNC(o0, f48) membar #Sync
  282. FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_JUMP(o0, f48, 402f) membar #Sync
  283. 312: FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_SYNC(o0, f48) membar #Sync
  284. FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_JUMP(o0, f48, 418f) membar #Sync
  285. 313: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_SYNC(o0, f48) membar #Sync
  286. FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_JUMP(o0, f48, 434f) membar #Sync
  287. VISLOOP_PAD
  288. 320: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) LOOP_CHUNK1(o1, o0, g6, 321f)
  289. FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) LOOP_CHUNK2(o1, o0, g6, 322f)
  290. FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) LOOP_CHUNK3(o1, o0, g6, 323f)
  291. b,pt %xcc, 320b+4; faligndata %f4, %f6, %f48
  292. 321: FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_SYNC(o0, f48) membar #Sync
  293. FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_JUMP(o0, f48, 404f) membar #Sync
  294. 322: FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_SYNC(o0, f48) membar #Sync
  295. FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_JUMP(o0, f48, 420f) membar #Sync
  296. 323: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_SYNC(o0, f48) membar #Sync
  297. FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_JUMP(o0, f48, 436f) membar #Sync
  298. VISLOOP_PAD
  299. 330: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) LOOP_CHUNK1(o1, o0, g6, 331f)
  300. FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) LOOP_CHUNK2(o1, o0, g6, 332f)
  301. FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) LOOP_CHUNK3(o1, o0, g6, 333f)
  302. b,pt %xcc, 330b+4; faligndata %f6, %f8, %f48
  303. 331: FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_SYNC(o0, f48) membar #Sync
  304. FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_JUMP(o0, f48, 406f) membar #Sync
  305. 332: FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_SYNC(o0, f48) membar #Sync
  306. FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_JUMP(o0, f48, 422f) membar #Sync
  307. 333: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_SYNC(o0, f48) membar #Sync
  308. FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_JUMP(o0, f48, 438f) membar #Sync
  309. VISLOOP_PAD
  310. 340: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) LOOP_CHUNK1(o1, o0, g6, 341f)
  311. FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) LOOP_CHUNK2(o1, o0, g6, 342f)
  312. FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) LOOP_CHUNK3(o1, o0, g6, 343f)
  313. b,pt %xcc, 340b+4; faligndata %f8, %f10, %f48
  314. 341: FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_SYNC(o0, f48) membar #Sync
  315. FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_JUMP(o0, f48, 408f) membar #Sync
  316. 342: FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_SYNC(o0, f48) membar #Sync
  317. FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_JUMP(o0, f48, 424f) membar #Sync
  318. 343: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_SYNC(o0, f48) membar #Sync
  319. FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_JUMP(o0, f48, 440f) membar #Sync
  320. VISLOOP_PAD
  321. 350: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) LOOP_CHUNK1(o1, o0, g6, 351f)
  322. FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) LOOP_CHUNK2(o1, o0, g6, 352f)
  323. FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) LOOP_CHUNK3(o1, o0, g6, 353f)
  324. b,pt %xcc, 350b+4; faligndata %f10, %f12, %f48
  325. 351: FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_SYNC(o0, f48) membar #Sync
  326. FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_JUMP(o0, f48, 410f) membar #Sync
  327. 352: FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_SYNC(o0, f48) membar #Sync
  328. FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_JUMP(o0, f48, 426f) membar #Sync
  329. 353: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_SYNC(o0, f48) membar #Sync
  330. FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_JUMP(o0, f48, 442f) membar #Sync
  331. VISLOOP_PAD
  332. 360: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) LOOP_CHUNK1(o1, o0, g6, 361f)
  333. FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) LOOP_CHUNK2(o1, o0, g6, 362f)
  334. FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) LOOP_CHUNK3(o1, o0, g6, 363f)
  335. b,pt %xcc, 360b+4; faligndata %f12, %f14, %f48
  336. 361: FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_SYNC(o0, f48) membar #Sync
  337. FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_JUMP(o0, f48, 412f) membar #Sync
  338. 362: FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_SYNC(o0, f48) membar #Sync
  339. FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_JUMP(o0, f48, 428f) membar #Sync
  340. 363: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_SYNC(o0, f48) membar #Sync
  341. FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_JUMP(o0, f48, 444f) membar #Sync
  342. VISLOOP_PAD
  343. 370: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) LOOP_CHUNK1(o1, o0, g6, 371f)
  344. FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) LOOP_CHUNK2(o1, o0, g6, 372f)
  345. FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) LOOP_CHUNK3(o1, o0, g6, 373f)
  346. b,pt %xcc, 370b+4; faligndata %f14, %f16, %f48
  347. 371: FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_SYNC(o0, f48) membar #Sync
  348. FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_JUMP(o0, f48, 414f) membar #Sync
  349. 372: FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_SYNC(o0, f48) membar #Sync
  350. FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_JUMP(o0, f48, 430f) membar #Sync
  351. 373: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_SYNC(o0, f48) membar #Sync
  352. FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_JUMP(o0, f48, 446f) membar #Sync
  353. VISLOOP_PAD
  354. 400: FINISH_VISCHUNK(o0, f0, f2, g3)
  355. 402: FINISH_VISCHUNK(o0, f2, f4, g3)
  356. 404: FINISH_VISCHUNK(o0, f4, f6, g3)
  357. 406: FINISH_VISCHUNK(o0, f6, f8, g3)
  358. 408: FINISH_VISCHUNK(o0, f8, f10, g3)
  359. 410: FINISH_VISCHUNK(o0, f10, f12, g3)
  360. 412: FINISH_VISCHUNK(o0, f12, f14, g3)
  361. 414: UNEVEN_VISCHUNK(o0, f14, f0, g3)
  362. 416: FINISH_VISCHUNK(o0, f16, f18, g3)
  363. 418: FINISH_VISCHUNK(o0, f18, f20, g3)
  364. 420: FINISH_VISCHUNK(o0, f20, f22, g3)
  365. 422: FINISH_VISCHUNK(o0, f22, f24, g3)
  366. 424: FINISH_VISCHUNK(o0, f24, f26, g3)
  367. 426: FINISH_VISCHUNK(o0, f26, f28, g3)
  368. 428: FINISH_VISCHUNK(o0, f28, f30, g3)
  369. 430: UNEVEN_VISCHUNK(o0, f30, f0, g3)
  370. 432: FINISH_VISCHUNK(o0, f32, f34, g3)
  371. 434: FINISH_VISCHUNK(o0, f34, f36, g3)
  372. 436: FINISH_VISCHUNK(o0, f36, f38, g3)
  373. 438: FINISH_VISCHUNK(o0, f38, f40, g3)
  374. 440: FINISH_VISCHUNK(o0, f40, f42, g3)
  375. 442: FINISH_VISCHUNK(o0, f42, f44, g3)
  376. 444: FINISH_VISCHUNK(o0, f44, f46, g3)
  377. 446: UNEVEN_VISCHUNK(o0, f46, f0, g3)
  378. 204: ldd [%o1], %f2 /* Load Group */
  379. add %o1, 8, %o1 /* IEU0 */
  380. subcc %g3, 8, %g3 /* IEU1 */
  381. faligndata %f0, %f2, %f8 /* GRU Group */
  382. std %f8, [%o0] /* Store */
  383. bl,pn %xcc, 205f /* CTI */
  384. add %o0, 8, %o0 /* IEU0 Group */
  385. ldd [%o1], %f0 /* Load Group */
  386. add %o1, 8, %o1 /* IEU0 */
  387. subcc %g3, 8, %g3 /* IEU1 */
  388. faligndata %f2, %f0, %f8 /* GRU Group */
  389. std %f8, [%o0] /* Store */
  390. bge,pt %xcc, 204b /* CTI */
  391. add %o0, 8, %o0 /* IEU0 Group */
  392. 205: brz,pt %o2, 207f /* CTI Group */
  393. mov %g1, %o1 /* IEU0 */
  394. 206: ldub [%o1], %g5 /* LOAD */
  395. add %o1, 1, %o1 /* IEU0 */
  396. add %o0, 1, %o0 /* IEU1 */
  397. subcc %o2, 1, %o2 /* IEU1 */
  398. bne,pt %xcc, 206b /* CTI */
  399. stb %g5, [%o0 - 1] /* Store Group */
  400. 207: membar #StoreLoad | #StoreStore /* LSU Group */
  401. wr %g0, FPRS_FEF, %fprs
  402. retl
  403. mov %g4, %o0
  404. 208: andcc %o2, 1, %g0 /* IEU1 Group */
  405. be,pt %icc, 2f+4 /* CTI */
  406. 1: ldub [%o1], %g5 /* LOAD Group */
  407. add %o1, 1, %o1 /* IEU0 */
  408. add %o0, 1, %o0 /* IEU1 */
  409. subcc %o2, 1, %o2 /* IEU1 Group */
  410. be,pn %xcc, 209f /* CTI */
  411. stb %g5, [%o0 - 1] /* Store */
  412. 2: ldub [%o1], %g5 /* LOAD Group */
  413. add %o0, 2, %o0 /* IEU0 */
  414. ldub [%o1 + 1], %o5 /* LOAD Group */
  415. add %o1, 2, %o1 /* IEU0 */
  416. subcc %o2, 2, %o2 /* IEU1 Group */
  417. stb %g5, [%o0 - 2] /* Store */
  418. bne,pt %xcc, 2b /* CTI */
  419. stb %o5, [%o0 - 1] /* Store */
  420. 209: retl
  421. mov %g4, %o0
  422. #ifdef USE_BPR
  423. /* void *__align_cpy_4(void *dest, void *src, size_t n)
  424. * SPARC v9 SYSV ABI
  425. * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 3))
  426. */
  427. .align 32
  428. ENTRY(__align_cpy_4)
  429. mov %o0, %g4 /* IEU0 Group */
  430. cmp %o2, 15 /* IEU1 */
  431. bleu,pn %xcc, 208b /* CTI */
  432. cmp %o2, (64 * 6) /* IEU1 Group */
  433. bgeu,pn %xcc, 200b /* CTI */
  434. andcc %o0, 7, %g2 /* IEU1 Group */
  435. ba,pt %xcc, 216f /* CTI */
  436. andcc %o1, 4, %g0 /* IEU1 Group */
  437. END(__align_cpy_4)
  438. /* void *__align_cpy_8(void *dest, void *src, size_t n)
  439. * SPARC v9 SYSV ABI
  440. * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 7))
  441. */
  442. .align 32
  443. ENTRY(__align_cpy_8)
  444. mov %o0, %g4 /* IEU0 Group */
  445. cmp %o2, 15 /* IEU1 */
  446. bleu,pn %xcc, 208b /* CTI */
  447. cmp %o2, (64 * 6) /* IEU1 Group */
  448. bgeu,pn %xcc, 201b /* CTI */
  449. andcc %o0, 0x38, %g5 /* IEU1 Group */
  450. andcc %o2, -128, %g6 /* IEU1 Group */
  451. bne,a,pt %xcc, 82f + 4 /* CTI */
  452. ldx [%o1], %g1 /* Load */
  453. ba,pt %xcc, 41f /* CTI Group */
  454. andcc %o2, 0x70, %g6 /* IEU1 */
  455. END(__align_cpy_8)
  456. /* void *__align_cpy_16(void *dest, void *src, size_t n)
  457. * SPARC v9 SYSV ABI
  458. * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 15))
  459. */
  460. .align 32
  461. ENTRY(__align_cpy_16)
  462. mov %o0, %g4 /* IEU0 Group */
  463. cmp %o2, (64 * 6) /* IEU1 */
  464. bgeu,pn %xcc, 201b /* CTI */
  465. andcc %o0, 0x38, %g5 /* IEU1 Group */
  466. andcc %o2, -128, %g6 /* IEU1 Group */
  467. bne,a,pt %xcc, 82f + 4 /* CTI */
  468. ldx [%o1], %g1 /* Load */
  469. ba,pt %xcc, 41f /* CTI Group */
  470. andcc %o2, 0x70, %g6 /* IEU1 */
  471. END(__align_cpy_16)
  472. #endif
  473. .align 32
  474. ENTRY(memcpy)
  475. 210:
  476. #ifndef USE_BPR
  477. srl %o2, 0, %o2 /* IEU1 Group */
  478. #endif
  479. brz,pn %o2, 209b /* CTI Group */
  480. mov %o0, %g4 /* IEU0 */
  481. 218: cmp %o2, 15 /* IEU1 Group */
  482. bleu,pn %xcc, 208b /* CTI */
  483. cmp %o2, (64 * 6) /* IEU1 Group */
  484. bgeu,pn %xcc, 200b /* CTI */
  485. andcc %o0, 7, %g2 /* IEU1 Group */
  486. sub %o0, %o1, %g5 /* IEU0 */
  487. andcc %g5, 3, %o5 /* IEU1 Group */
  488. bne,pn %xcc, 212f /* CTI */
  489. andcc %o1, 3, %g0 /* IEU1 Group */
  490. be,a,pt %xcc, 216f /* CTI */
  491. andcc %o1, 4, %g0 /* IEU1 Group */
  492. andcc %o1, 1, %g0 /* IEU1 Group */
  493. be,pn %xcc, 4f /* CTI */
  494. andcc %o1, 2, %g0 /* IEU1 Group */
  495. ldub [%o1], %g2 /* Load Group */
  496. add %o1, 1, %o1 /* IEU0 */
  497. add %o0, 1, %o0 /* IEU1 */
  498. sub %o2, 1, %o2 /* IEU0 Group */
  499. bne,pn %xcc, 5f /* CTI Group */
  500. stb %g2, [%o0 - 1] /* Store */
  501. 4: lduh [%o1], %g2 /* Load Group */
  502. add %o1, 2, %o1 /* IEU0 */
  503. add %o0, 2, %o0 /* IEU1 */
  504. sub %o2, 2, %o2 /* IEU0 */
  505. sth %g2, [%o0 - 2] /* Store Group + bubble */
  506. 5: andcc %o1, 4, %g0 /* IEU1 */
  507. 216: be,a,pn %xcc, 2f /* CTI */
  508. andcc %o2, -128, %g6 /* IEU1 Group */
  509. lduw [%o1], %g5 /* Load Group */
  510. add %o1, 4, %o1 /* IEU0 */
  511. add %o0, 4, %o0 /* IEU1 */
  512. sub %o2, 4, %o2 /* IEU0 Group */
  513. stw %g5, [%o0 - 4] /* Store */
  514. andcc %o2, -128, %g6 /* IEU1 Group */
  515. 2: be,pn %xcc, 215f /* CTI */
  516. andcc %o0, 4, %g0 /* IEU1 Group */
  517. be,pn %xcc, 82f + 4 /* CTI Group */
  518. 5: MOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
  519. MOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
  520. MOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
  521. MOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
  522. 35: subcc %g6, 128, %g6 /* IEU1 Group */
  523. add %o1, 128, %o1 /* IEU0 */
  524. bne,pt %xcc, 5b /* CTI */
  525. add %o0, 128, %o0 /* IEU0 Group */
  526. 215: andcc %o2, 0x70, %g6 /* IEU1 Group */
  527. 41: be,pn %xcc, 80f /* CTI */
  528. andcc %o2, 8, %g0 /* IEU1 Group */
  529. /* Clk1 8-( */
  530. /* Clk2 8-( */
  531. /* Clk3 8-( */
  532. /* Clk4 8-( */
  533. 79: rd %pc, %o5 /* PDU Group */
  534. sll %g6, 1, %g5 /* IEU0 Group */
  535. add %o1, %g6, %o1 /* IEU1 */
  536. sub %o5, %g5, %o5 /* IEU0 Group */
  537. jmpl %o5 + %lo(80f - 79b), %g0 /* CTI Group brk forced*/
  538. add %o0, %g6, %o0 /* IEU0 Group */
  539. 36: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
  540. MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
  541. MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
  542. MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
  543. MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
  544. MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
  545. MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
  546. 80: be,pt %xcc, 81f /* CTI */
  547. andcc %o2, 4, %g0 /* IEU1 */
  548. ldx [%o1], %g2 /* Load Group */
  549. add %o0, 8, %o0 /* IEU0 */
  550. stw %g2, [%o0 - 0x4] /* Store Group */
  551. add %o1, 8, %o1 /* IEU1 */
  552. srlx %g2, 32, %g2 /* IEU0 Group */
  553. stw %g2, [%o0 - 0x8] /* Store */
  554. 81: be,pt %xcc, 1f /* CTI */
  555. andcc %o2, 2, %g0 /* IEU1 Group */
  556. lduw [%o1], %g2 /* Load Group */
  557. add %o1, 4, %o1 /* IEU0 */
  558. stw %g2, [%o0] /* Store Group */
  559. add %o0, 4, %o0 /* IEU0 */
  560. 1: be,pt %xcc, 1f /* CTI */
  561. andcc %o2, 1, %g0 /* IEU1 Group */
  562. lduh [%o1], %g2 /* Load Group */
  563. add %o1, 2, %o1 /* IEU0 */
  564. sth %g2, [%o0] /* Store Group */
  565. add %o0, 2, %o0 /* IEU0 */
  566. 1: be,pt %xcc, 211f /* CTI */
  567. nop /* IEU1 */
  568. ldub [%o1], %g2 /* Load Group */
  569. stb %g2, [%o0] /* Store Group + bubble */
  570. 211: retl
  571. mov %g4, %o0
  572. 82: MOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
  573. MOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
  574. 37: subcc %g6, 128, %g6 /* IEU1 Group */
  575. add %o1, 128, %o1 /* IEU0 */
  576. bne,pt %xcc, 82b /* CTI */
  577. add %o0, 128, %o0 /* IEU0 Group */
  578. andcc %o2, 0x70, %g6 /* IEU1 */
  579. be,pn %xcc, 84f /* CTI */
  580. andcc %o2, 8, %g0 /* IEU1 Group */
  581. /* Clk1 8-( */
  582. /* Clk2 8-( */
  583. /* Clk3 8-( */
  584. /* Clk4 8-( */
  585. 83: rd %pc, %o5 /* PDU Group */
  586. add %o1, %g6, %o1 /* IEU0 Group */
  587. sub %o5, %g6, %o5 /* IEU1 */
  588. jmpl %o5 + %lo(84f - 83b), %g0 /* CTI Group brk forced*/
  589. add %o0, %g6, %o0 /* IEU0 Group */
  590. 38: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
  591. MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
  592. MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
  593. MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
  594. MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
  595. MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
  596. MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
  597. 84: be,pt %xcc, 85f /* CTI Group */
  598. andcc %o2, 4, %g0 /* IEU1 */
  599. ldx [%o1], %g2 /* Load Group */
  600. add %o0, 8, %o0 /* IEU0 */
  601. add %o1, 8, %o1 /* IEU0 Group */
  602. stx %g2, [%o0 - 0x8] /* Store */
  603. 85: be,pt %xcc, 1f /* CTI */
  604. andcc %o2, 2, %g0 /* IEU1 Group */
  605. lduw [%o1], %g2 /* Load Group */
  606. add %o0, 4, %o0 /* IEU0 */
  607. add %o1, 4, %o1 /* IEU0 Group */
  608. stw %g2, [%o0 - 0x4] /* Store */
  609. 1: be,pt %xcc, 1f /* CTI */
  610. andcc %o2, 1, %g0 /* IEU1 Group */
  611. lduh [%o1], %g2 /* Load Group */
  612. add %o0, 2, %o0 /* IEU0 */
  613. add %o1, 2, %o1 /* IEU0 Group */
  614. sth %g2, [%o0 - 0x2] /* Store */
  615. 1: be,pt %xcc, 1f /* CTI */
  616. nop /* IEU0 Group */
  617. ldub [%o1], %g2 /* Load Group */
  618. stb %g2, [%o0] /* Store Group + bubble */
  619. 1: retl
  620. mov %g4, %o0
  621. 212: brz,pt %g2, 2f /* CTI Group */
  622. mov 8, %g1 /* IEU0 */
  623. sub %g1, %g2, %g2 /* IEU0 Group */
  624. sub %o2, %g2, %o2 /* IEU0 Group */
  625. 1: ldub [%o1], %g5 /* Load Group */
  626. add %o1, 1, %o1 /* IEU0 */
  627. add %o0, 1, %o0 /* IEU1 */
  628. subcc %g2, 1, %g2 /* IEU1 Group */
  629. bne,pt %xcc, 1b /* CTI */
  630. stb %g5, [%o0 - 1] /* Store */
  631. 2: andn %o2, 7, %g5 /* IEU0 Group */
  632. and %o2, 7, %o2 /* IEU1 */
  633. fmovd %f0, %f2 /* FPU */
  634. alignaddr %o1, %g0, %g1 /* GRU Group */
  635. ldd [%g1], %f4 /* Load Group */
  636. 1: ldd [%g1 + 0x8], %f6 /* Load Group */
  637. add %g1, 0x8, %g1 /* IEU0 Group */
  638. subcc %g5, 8, %g5 /* IEU1 */
  639. faligndata %f4, %f6, %f0 /* GRU Group */
  640. std %f0, [%o0] /* Store */
  641. add %o1, 8, %o1 /* IEU0 Group */
  642. be,pn %xcc, 213f /* CTI */
  643. add %o0, 8, %o0 /* IEU1 */
  644. ldd [%g1 + 0x8], %f4 /* Load Group */
  645. add %g1, 8, %g1 /* IEU0 */
  646. subcc %g5, 8, %g5 /* IEU1 */
  647. faligndata %f6, %f4, %f0 /* GRU Group */
  648. std %f0, [%o0] /* Store */
  649. add %o1, 8, %o1 /* IEU0 */
  650. bne,pn %xcc, 1b /* CTI Group */
  651. add %o0, 8, %o0 /* IEU0 */
  652. 213: brz,pn %o2, 214f /* CTI Group */
  653. nop /* IEU0 */
  654. ldub [%o1], %g5 /* LOAD */
  655. add %o1, 1, %o1 /* IEU0 */
  656. add %o0, 1, %o0 /* IEU1 */
  657. subcc %o2, 1, %o2 /* IEU1 */
  658. bne,pt %xcc, 206b /* CTI */
  659. stb %g5, [%o0 - 1] /* Store Group */
  660. 214: wr %g0, FPRS_FEF, %fprs
  661. retl
  662. mov %g4, %o0
  663. END(memcpy)
  664. libc_hidden_def(memcpy)
  665. .align 32
  666. 228: andcc %o2, 1, %g0 /* IEU1 Group */
  667. be,pt %icc, 2f+4 /* CTI */
  668. 1: ldub [%o1 - 1], %o5 /* LOAD Group */
  669. sub %o1, 1, %o1 /* IEU0 */
  670. sub %o0, 1, %o0 /* IEU1 */
  671. subcc %o2, 1, %o2 /* IEU1 Group */
  672. be,pn %xcc, 229f /* CTI */
  673. stb %o5, [%o0] /* Store */
  674. 2: ldub [%o1 - 1], %o5 /* LOAD Group */
  675. sub %o0, 2, %o0 /* IEU0 */
  676. ldub [%o1 - 2], %g5 /* LOAD Group */
  677. sub %o1, 2, %o1 /* IEU0 */
  678. subcc %o2, 2, %o2 /* IEU1 Group */
  679. stb %o5, [%o0 + 1] /* Store */
  680. bne,pt %xcc, 2b /* CTI */
  681. stb %g5, [%o0] /* Store */
  682. 229: retl
  683. mov %g4, %o0
  684. 219: retl
  685. nop
  686. .align 32
  687. ENTRY(memmove)
  688. #ifndef USE_BPR
  689. srl %o2, 0, %o2 /* IEU1 Group */
  690. #endif
  691. brz,pn %o2, 219b /* CTI Group */
  692. sub %o0, %o1, %o4 /* IEU0 */
  693. cmp %o4, %o2 /* IEU1 Group */
  694. bgeu,pt %XCC, 218b /* CTI */
  695. mov %o0, %g4 /* IEU0 */
  696. add %o0, %o2, %o0 /* IEU0 Group */
  697. 220: add %o1, %o2, %o1 /* IEU1 */
  698. cmp %o2, 15 /* IEU1 Group */
  699. bleu,pn %xcc, 228b /* CTI */
  700. andcc %o0, 7, %g2 /* IEU1 Group */
  701. sub %o0, %o1, %g5 /* IEU0 */
  702. andcc %g5, 3, %o5 /* IEU1 Group */
  703. bne,pn %xcc, 232f /* CTI */
  704. andcc %o1, 3, %g0 /* IEU1 Group */
  705. be,a,pt %xcc, 236f /* CTI */
  706. andcc %o1, 4, %g0 /* IEU1 Group */
  707. andcc %o1, 1, %g0 /* IEU1 Group */
  708. be,pn %xcc, 4f /* CTI */
  709. andcc %o1, 2, %g0 /* IEU1 Group */
  710. ldub [%o1 - 1], %g2 /* Load Group */
  711. sub %o1, 1, %o1 /* IEU0 */
  712. sub %o0, 1, %o0 /* IEU1 */
  713. sub %o2, 1, %o2 /* IEU0 Group */
  714. be,pn %xcc, 5f /* CTI Group */
  715. stb %g2, [%o0] /* Store */
  716. 4: lduh [%o1 - 2], %g2 /* Load Group */
  717. sub %o1, 2, %o1 /* IEU0 */
  718. sub %o0, 2, %o0 /* IEU1 */
  719. sub %o2, 2, %o2 /* IEU0 */
  720. sth %g2, [%o0] /* Store Group + bubble */
  721. 5: andcc %o1, 4, %g0 /* IEU1 */
  722. 236: be,a,pn %xcc, 2f /* CTI */
  723. andcc %o2, -128, %g6 /* IEU1 Group */
  724. lduw [%o1 - 4], %g5 /* Load Group */
  725. sub %o1, 4, %o1 /* IEU0 */
  726. sub %o0, 4, %o0 /* IEU1 */
  727. sub %o2, 4, %o2 /* IEU0 Group */
  728. stw %g5, [%o0] /* Store */
  729. andcc %o2, -128, %g6 /* IEU1 Group */
  730. 2: be,pn %xcc, 235f /* CTI */
  731. andcc %o0, 4, %g0 /* IEU1 Group */
  732. be,pn %xcc, 282f + 4 /* CTI Group */
  733. 5: RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
  734. RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
  735. RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
  736. RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
  737. subcc %g6, 128, %g6 /* IEU1 Group */
  738. sub %o1, 128, %o1 /* IEU0 */
  739. bne,pt %xcc, 5b /* CTI */
  740. sub %o0, 128, %o0 /* IEU0 Group */
  741. 235: andcc %o2, 0x70, %g6 /* IEU1 Group */
  742. 41: be,pn %xcc, 280f /* CTI */
  743. andcc %o2, 8, %g0 /* IEU1 Group */
  744. /* Clk1 8-( */
  745. /* Clk2 8-( */
  746. /* Clk3 8-( */
  747. /* Clk4 8-( */
  748. 279: rd %pc, %o5 /* PDU Group */
  749. sll %g6, 1, %g5 /* IEU0 Group */
  750. sub %o1, %g6, %o1 /* IEU1 */
  751. sub %o5, %g5, %o5 /* IEU0 Group */
  752. jmpl %o5 + %lo(280f - 279b), %g0 /* CTI Group brk forced*/
  753. sub %o0, %g6, %o0 /* IEU0 Group */
  754. RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
  755. RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
  756. RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
  757. RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
  758. RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
  759. RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
  760. RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
  761. 280: be,pt %xcc, 281f /* CTI */
  762. andcc %o2, 4, %g0 /* IEU1 */
  763. ldx [%o1 - 8], %g2 /* Load Group */
  764. sub %o0, 8, %o0 /* IEU0 */
  765. stw %g2, [%o0 + 4] /* Store Group */
  766. sub %o1, 8, %o1 /* IEU1 */
  767. srlx %g2, 32, %g2 /* IEU0 Group */
  768. stw %g2, [%o0] /* Store */
  769. 281: be,pt %xcc, 1f /* CTI */
  770. andcc %o2, 2, %g0 /* IEU1 Group */
  771. lduw [%o1 - 4], %g2 /* Load Group */
  772. sub %o1, 4, %o1 /* IEU0 */
  773. stw %g2, [%o0 - 4] /* Store Group */
  774. sub %o0, 4, %o0 /* IEU0 */
  775. 1: be,pt %xcc, 1f /* CTI */
  776. andcc %o2, 1, %g0 /* IEU1 Group */
  777. lduh [%o1 - 2], %g2 /* Load Group */
  778. sub %o1, 2, %o1 /* IEU0 */
  779. sth %g2, [%o0 - 2] /* Store Group */
  780. sub %o0, 2, %o0 /* IEU0 */
  781. 1: be,pt %xcc, 211f /* CTI */
  782. nop /* IEU1 */
  783. ldub [%o1 - 1], %g2 /* Load Group */
  784. stb %g2, [%o0 - 1] /* Store Group + bubble */
  785. 211: retl
  786. mov %g4, %o0
  787. 282: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
  788. RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
  789. subcc %g6, 128, %g6 /* IEU1 Group */
  790. sub %o1, 128, %o1 /* IEU0 */
  791. bne,pt %xcc, 282b /* CTI */
  792. sub %o0, 128, %o0 /* IEU0 Group */
  793. andcc %o2, 0x70, %g6 /* IEU1 */
  794. be,pn %xcc, 284f /* CTI */
  795. andcc %o2, 8, %g0 /* IEU1 Group */
  796. /* Clk1 8-( */
  797. /* Clk2 8-( */
  798. /* Clk3 8-( */
  799. /* Clk4 8-( */
  800. 283: rd %pc, %o5 /* PDU Group */
  801. sub %o1, %g6, %o1 /* IEU0 Group */
  802. sub %o5, %g6, %o5 /* IEU1 */
  803. jmpl %o5 + %lo(284f - 283b), %g0 /* CTI Group brk forced*/
  804. sub %o0, %g6, %o0 /* IEU0 Group */
  805. RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
  806. RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
  807. RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
  808. RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
  809. RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
  810. RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
  811. RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
  812. 284: be,pt %xcc, 285f /* CTI Group */
  813. andcc %o2, 4, %g0 /* IEU1 */
  814. ldx [%o1 - 8], %g2 /* Load Group */
  815. sub %o0, 8, %o0 /* IEU0 */
  816. sub %o1, 8, %o1 /* IEU0 Group */
  817. stx %g2, [%o0] /* Store */
  818. 285: be,pt %xcc, 1f /* CTI */
  819. andcc %o2, 2, %g0 /* IEU1 Group */
  820. lduw [%o1 - 4], %g2 /* Load Group */
  821. sub %o0, 4, %o0 /* IEU0 */
  822. sub %o1, 4, %o1 /* IEU0 Group */
  823. stw %g2, [%o0] /* Store */
  824. 1: be,pt %xcc, 1f /* CTI */
  825. andcc %o2, 1, %g0 /* IEU1 Group */
  826. lduh [%o1 - 2], %g2 /* Load Group */
  827. sub %o0, 2, %o0 /* IEU0 */
  828. sub %o1, 2, %o1 /* IEU0 Group */
  829. sth %g2, [%o0] /* Store */
  830. 1: be,pt %xcc, 1f /* CTI */
  831. nop /* IEU0 Group */
  832. ldub [%o1 - 1], %g2 /* Load Group */
  833. stb %g2, [%o0 - 1] /* Store Group + bubble */
  834. 1: retl
  835. mov %g4, %o0
  836. 232: brz,pt %g2, 2f /* CTI Group */
  837. sub %o2, %g2, %o2 /* IEU0 Group */
  838. 1: ldub [%o1 - 1], %g5 /* Load Group */
  839. sub %o1, 1, %o1 /* IEU0 */
  840. sub %o0, 1, %o0 /* IEU1 */
  841. subcc %g2, 1, %g2 /* IEU1 Group */
  842. bne,pt %xcc, 1b /* CTI */
  843. stb %g5, [%o0] /* Store */
  844. 2: andn %o2, 7, %g5 /* IEU0 Group */
  845. and %o2, 7, %o2 /* IEU1 */
  846. fmovd %f0, %f2 /* FPU */
  847. alignaddr %o1, %g0, %g1 /* GRU Group */
  848. ldd [%g1], %f4 /* Load Group */
  849. 1: ldd [%g1 - 8], %f6 /* Load Group */
  850. sub %g1, 8, %g1 /* IEU0 Group */
  851. subcc %g5, 8, %g5 /* IEU1 */
  852. faligndata %f6, %f4, %f0 /* GRU Group */
  853. std %f0, [%o0 - 8] /* Store */
  854. sub %o1, 8, %o1 /* IEU0 Group */
  855. be,pn %xcc, 233f /* CTI */
  856. sub %o0, 8, %o0 /* IEU1 */
  857. ldd [%g1 - 8], %f4 /* Load Group */
  858. sub %g1, 8, %g1 /* IEU0 */
  859. subcc %g5, 8, %g5 /* IEU1 */
  860. faligndata %f4, %f6, %f0 /* GRU Group */
  861. std %f0, [%o0 - 8] /* Store */
  862. sub %o1, 8, %o1 /* IEU0 */
  863. bne,pn %xcc, 1b /* CTI Group */
  864. sub %o0, 8, %o0 /* IEU0 */
  865. 233: brz,pn %o2, 234f /* CTI Group */
  866. nop /* IEU0 */
  867. 237: ldub [%o1 - 1], %g5 /* LOAD */
  868. sub %o1, 1, %o1 /* IEU0 */
  869. sub %o0, 1, %o0 /* IEU1 */
  870. subcc %o2, 1, %o2 /* IEU1 */
  871. bne,pt %xcc, 237b /* CTI */
  872. stb %g5, [%o0] /* Store Group */
  873. 234: wr %g0, FPRS_FEF, %fprs
  874. retl
  875. mov %g4, %o0
  876. END(memmove)
  877. libc_hidden_def(memmove)
  878. #ifdef USE_BPR
  879. weak_alias(memcpy,__align_cpy_1)
  880. weak_alias(memcpy,__align_cpy_2)
  881. #endif