memcpy.S 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. /* Copy SIZE bytes from SRC to DEST.
  2. For SPARC v7.
  3. Copyright (C) 1996, 1999, 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>,
  6. Eddie C. Dost <ecd@skynet.be> and
  7. Jakub Jelinek <jj@ultra.linux.cz>.
  8. The GNU C Library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. The GNU C Library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with the GNU C Library; if not, write to the Free
  18. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19. 02111-1307 USA. */
  20. /* Both these macros have to start with exactly the same insn */
  21. #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
  22. ldd [%src + offset + 0x00], %t0; \
  23. ldd [%src + offset + 0x08], %t2; \
  24. ldd [%src + offset + 0x10], %t4; \
  25. ldd [%src + offset + 0x18], %t6; \
  26. st %t0, [%dst + offset + 0x00]; \
  27. st %t1, [%dst + offset + 0x04]; \
  28. st %t2, [%dst + offset + 0x08]; \
  29. st %t3, [%dst + offset + 0x0c]; \
  30. st %t4, [%dst + offset + 0x10]; \
  31. st %t5, [%dst + offset + 0x14]; \
  32. st %t6, [%dst + offset + 0x18]; \
  33. st %t7, [%dst + offset + 0x1c];
  34. #define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
  35. ldd [%src + offset + 0x00], %t0; \
  36. ldd [%src + offset + 0x08], %t2; \
  37. ldd [%src + offset + 0x10], %t4; \
  38. ldd [%src + offset + 0x18], %t6; \
  39. std %t0, [%dst + offset + 0x00]; \
  40. std %t2, [%dst + offset + 0x08]; \
  41. std %t4, [%dst + offset + 0x10]; \
  42. std %t6, [%dst + offset + 0x18];
  43. #define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
  44. ldd [%src - offset - 0x10], %t0; \
  45. ldd [%src - offset - 0x08], %t2; \
  46. st %t0, [%dst - offset - 0x10]; \
  47. st %t1, [%dst - offset - 0x0c]; \
  48. st %t2, [%dst - offset - 0x08]; \
  49. st %t3, [%dst - offset - 0x04];
  50. #define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
  51. ldd [%src - offset - 0x10], %t0; \
  52. ldd [%src - offset - 0x08], %t2; \
  53. std %t0, [%dst - offset - 0x10]; \
  54. std %t2, [%dst - offset - 0x08];
  55. #define MOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
  56. ldub [%src - offset - 0x02], %t0; \
  57. ldub [%src - offset - 0x01], %t1; \
  58. stb %t0, [%dst - offset - 0x02]; \
  59. stb %t1, [%dst - offset - 0x01];
  60. /* Both these macros have to start with exactly the same insn */
  61. #define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
  62. ldd [%src - offset - 0x20], %t0; \
  63. ldd [%src - offset - 0x18], %t2; \
  64. ldd [%src - offset - 0x10], %t4; \
  65. ldd [%src - offset - 0x08], %t6; \
  66. st %t0, [%dst - offset - 0x20]; \
  67. st %t1, [%dst - offset - 0x1c]; \
  68. st %t2, [%dst - offset - 0x18]; \
  69. st %t3, [%dst - offset - 0x14]; \
  70. st %t4, [%dst - offset - 0x10]; \
  71. st %t5, [%dst - offset - 0x0c]; \
  72. st %t6, [%dst - offset - 0x08]; \
  73. st %t7, [%dst - offset - 0x04];
  74. #define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
  75. ldd [%src - offset - 0x20], %t0; \
  76. ldd [%src - offset - 0x18], %t2; \
  77. ldd [%src - offset - 0x10], %t4; \
  78. ldd [%src - offset - 0x08], %t6; \
  79. std %t0, [%dst - offset - 0x20]; \
  80. std %t2, [%dst - offset - 0x18]; \
  81. std %t4, [%dst - offset - 0x10]; \
  82. std %t6, [%dst - offset - 0x08];
  83. #define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
  84. ldd [%src + offset + 0x00], %t0; \
  85. ldd [%src + offset + 0x08], %t2; \
  86. st %t0, [%dst + offset + 0x00]; \
  87. st %t1, [%dst + offset + 0x04]; \
  88. st %t2, [%dst + offset + 0x08]; \
  89. st %t3, [%dst + offset + 0x0c];
  90. #define RMOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
  91. ldub [%src + offset + 0x00], %t0; \
  92. ldub [%src + offset + 0x01], %t1; \
  93. stb %t0, [%dst + offset + 0x00]; \
  94. stb %t1, [%dst + offset + 0x01];
  95. #define SMOVE_CHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \
  96. ldd [%src + offset + 0x00], %t0; \
  97. ldd [%src + offset + 0x08], %t2; \
  98. srl %t0, shir, %t5; \
  99. srl %t1, shir, %t6; \
  100. sll %t0, shil, %t0; \
  101. or %t5, %prev, %t5; \
  102. sll %t1, shil, %prev; \
  103. or %t6, %t0, %t0; \
  104. srl %t2, shir, %t1; \
  105. srl %t3, shir, %t6; \
  106. sll %t2, shil, %t2; \
  107. or %t1, %prev, %t1; \
  108. std %t4, [%dst + offset + offset2 - 0x04]; \
  109. std %t0, [%dst + offset + offset2 + 0x04]; \
  110. sll %t3, shil, %prev; \
  111. or %t6, %t2, %t4;
  112. #define SMOVE_ALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \
  113. ldd [%src + offset + 0x00], %t0; \
  114. ldd [%src + offset + 0x08], %t2; \
  115. srl %t0, shir, %t4; \
  116. srl %t1, shir, %t5; \
  117. sll %t0, shil, %t6; \
  118. or %t4, %prev, %t0; \
  119. sll %t1, shil, %prev; \
  120. or %t5, %t6, %t1; \
  121. srl %t2, shir, %t4; \
  122. srl %t3, shir, %t5; \
  123. sll %t2, shil, %t6; \
  124. or %t4, %prev, %t2; \
  125. sll %t3, shil, %prev; \
  126. or %t5, %t6, %t3; \
  127. std %t0, [%dst + offset + offset2 + 0x00]; \
  128. std %t2, [%dst + offset + offset2 + 0x08];
  129. .text
  130. .align 4
  131. 70: andcc %o1, 1, %g0
  132. be 4f
  133. andcc %o1, 2, %g0
  134. ldub [%o1 - 1], %g2
  135. sub %o1, 1, %o1
  136. stb %g2, [%o0 - 1]
  137. sub %o2, 1, %o2
  138. be 3f
  139. sub %o0, 1, %o0
  140. 4: lduh [%o1 - 2], %g2
  141. sub %o1, 2, %o1
  142. sth %g2, [%o0 - 2]
  143. sub %o2, 2, %o2
  144. b 3f
  145. sub %o0, 2, %o0
  146. ENTRY(__bcopy)
  147. mov %o0, %o3
  148. mov %o1, %o0
  149. mov %o3, %o1
  150. END(__bcopy)
  151. strong_alias(__bcopy,bcopy)
  152. ENTRY(__memmove)
  153. cmp %o0, %o1
  154. st %o0, [%sp + 64]
  155. bleu 9f
  156. sub %o0, %o1, %o4
  157. add %o1, %o2, %o3
  158. cmp %o3, %o0
  159. bleu 0f
  160. andcc %o4, 3, %o5
  161. add %o1, %o2, %o1
  162. add %o0, %o2, %o0
  163. bne 77f
  164. cmp %o2, 15
  165. bleu 91f
  166. andcc %o1, 3, %g0
  167. bne 70b
  168. 3: andcc %o1, 4, %g0
  169. be 2f
  170. mov %o2, %g1
  171. ld [%o1 - 4], %o4
  172. sub %g1, 4, %g1
  173. st %o4, [%o0 - 4]
  174. sub %o1, 4, %o1
  175. sub %o0, 4, %o0
  176. 2: andcc %g1, 0xffffff80, %g6
  177. be 3f
  178. andcc %o0, 4, %g0
  179. be 74f + 4
  180. 5: RMOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
  181. RMOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
  182. RMOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
  183. RMOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
  184. subcc %g6, 128, %g6
  185. sub %o1, 128, %o1
  186. bne 5b
  187. sub %o0, 128, %o0
  188. 3: andcc %g1, 0x70, %g6
  189. be 72f
  190. andcc %g1, 8, %g0
  191. srl %g6, 1, %o4
  192. mov %o7, %g2
  193. add %g6, %o4, %o4
  194. 101: call 100f
  195. sub %o1, %g6, %o1
  196. mov %g2, %o7
  197. jmpl %o5 + (72f - 101b), %g0
  198. sub %o0, %g6, %o0
  199. 71: RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
  200. RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
  201. RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
  202. RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
  203. RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
  204. RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
  205. RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
  206. 72: be 73f
  207. andcc %g1, 4, %g0
  208. ldd [%o1 - 0x08], %g2
  209. sub %o0, 8, %o0
  210. sub %o1, 8, %o1
  211. st %g2, [%o0]
  212. st %g3, [%o0 + 0x04]
  213. 73: be 1f
  214. andcc %g1, 2, %g0
  215. ld [%o1 - 4], %g2
  216. sub %o1, 4, %o1
  217. st %g2, [%o0 - 4]
  218. sub %o0, 4, %o0
  219. 1: be 1f
  220. andcc %g1, 1, %g0
  221. lduh [%o1 - 2], %g2
  222. sub %o1, 2, %o1
  223. sth %g2, [%o0 - 2]
  224. sub %o0, 2, %o0
  225. 1: be 1f
  226. nop
  227. ldub [%o1 - 1], %g2
  228. stb %g2, [%o0 - 1]
  229. 1: retl
  230. ld [%sp + 64], %o0
  231. 74: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
  232. RMOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
  233. RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
  234. RMOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
  235. subcc %g6, 128, %g6
  236. sub %o1, 128, %o1
  237. bne 74b
  238. sub %o0, 128, %o0
  239. andcc %g1, 0x70, %g6
  240. be 72b
  241. andcc %g1, 8, %g0
  242. srl %g6, 1, %o4
  243. mov %o7, %g2
  244. add %g6, %o4, %o4
  245. 102: call 100f
  246. sub %o1, %g6, %o1
  247. mov %g2, %o7
  248. jmpl %o5 + (72b - 102b), %g0
  249. sub %o0, %g6, %o0
  250. 75: and %o2, 0xe, %o3
  251. mov %o7, %g2
  252. sll %o3, 3, %o4
  253. sub %o0, %o3, %o0
  254. 103: call 100f
  255. sub %o1, %o3, %o1
  256. mov %g2, %o7
  257. jmpl %o5 + (76f - 103b), %g0
  258. andcc %o2, 1, %g0
  259. RMOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
  260. RMOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
  261. RMOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
  262. RMOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
  263. RMOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
  264. RMOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
  265. RMOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
  266. 76: be 1f
  267. nop
  268. ldub [%o1 - 1], %g2
  269. stb %g2, [%o0 - 1]
  270. 1: retl
  271. ld [%sp + 64], %o0
  272. 91: bne 75b
  273. andcc %o2, 8, %g0
  274. be 1f
  275. andcc %o2, 4, %g0
  276. ld [%o1 - 0x08], %g2
  277. ld [%o1 - 0x04], %g3
  278. sub %o1, 8, %o1
  279. st %g2, [%o0 - 0x08]
  280. st %g3, [%o0 - 0x04]
  281. sub %o0, 8, %o0
  282. 1: b 73b
  283. mov %o2, %g1
  284. 77: cmp %o2, 15
  285. bleu 75b
  286. andcc %o0, 3, %g0
  287. be 64f
  288. andcc %o0, 1, %g0
  289. be 63f
  290. andcc %o0, 2, %g0
  291. ldub [%o1 - 1], %g5
  292. sub %o1, 1, %o1
  293. stb %g5, [%o0 - 1]
  294. sub %o0, 1, %o0
  295. be 64f
  296. sub %o2, 1, %o2
  297. 63: ldub [%o1 - 1], %g5
  298. sub %o1, 2, %o1
  299. stb %g5, [%o0 - 1]
  300. sub %o0, 2, %o0
  301. ldub [%o1], %g5
  302. sub %o2, 2, %o2
  303. stb %g5, [%o0]
  304. 64: and %o1, 3, %g2
  305. and %o1, -4, %o1
  306. and %o2, 0xc, %g3
  307. add %o1, 4, %o1
  308. cmp %g3, 4
  309. sll %g2, 3, %g4
  310. mov 32, %g2
  311. be 4f
  312. sub %g2, %g4, %g6
  313. blu 3f
  314. cmp %g3, 8
  315. be 2f
  316. srl %o2, 2, %g3
  317. ld [%o1 - 4], %o3
  318. add %o0, -8, %o0
  319. ld [%o1 - 8], %o4
  320. add %o1, -16, %o1
  321. b 7f
  322. add %g3, 1, %g3
  323. 2: ld [%o1 - 4], %o4
  324. add %o0, -4, %o0
  325. ld [%o1 - 8], %g1
  326. add %o1, -12, %o1
  327. b 8f
  328. add %g3, 2, %g3
  329. 3: ld [%o1 - 4], %o5
  330. add %o0, -12, %o0
  331. ld [%o1 - 8], %o3
  332. add %o1, -20, %o1
  333. b 6f
  334. srl %o2, 2, %g3
  335. 4: ld [%o1 - 4], %g1
  336. srl %o2, 2, %g3
  337. ld [%o1 - 8], %o5
  338. add %o1, -24, %o1
  339. add %o0, -16, %o0
  340. add %g3, -1, %g3
  341. ld [%o1 + 12], %o3
  342. 5: sll %o5, %g4, %g2
  343. srl %g1, %g6, %g5
  344. or %g2, %g5, %g2
  345. st %g2, [%o0 + 12]
  346. 6: ld [%o1 + 8], %o4
  347. sll %o3, %g4, %g2
  348. srl %o5, %g6, %g5
  349. or %g2, %g5, %g2
  350. st %g2, [%o0 + 8]
  351. 7: ld [%o1 + 4], %g1
  352. sll %o4, %g4, %g2
  353. srl %o3, %g6, %g5
  354. or %g2, %g5, %g2
  355. st %g2, [%o0 + 4]
  356. 8: ld [%o1], %o5
  357. sll %g1, %g4, %g2
  358. srl %o4, %g6, %g5
  359. addcc %g3, -4, %g3
  360. or %g2, %g5, %g2
  361. add %o1, -16, %o1
  362. st %g2, [%o0]
  363. add %o0, -16, %o0
  364. bne,a 5b
  365. ld [%o1 + 12], %o3
  366. sll %o5, %g4, %g2
  367. srl %g1, %g6, %g5
  368. srl %g4, 3, %g3
  369. or %g2, %g5, %g2
  370. add %o1, %g3, %o1
  371. andcc %o2, 2, %g0
  372. st %g2, [%o0 + 12]
  373. be 1f
  374. andcc %o2, 1, %g0
  375. ldub [%o1 + 15], %g5
  376. add %o1, -2, %o1
  377. stb %g5, [%o0 + 11]
  378. add %o0, -2, %o0
  379. ldub [%o1 + 16], %g5
  380. stb %g5, [%o0 + 12]
  381. 1: be 1f
  382. nop
  383. ldub [%o1 + 15], %g5
  384. stb %g5, [%o0 + 11]
  385. 1: retl
  386. ld [%sp + 64], %o0
  387. 78: andcc %o1, 1, %g0
  388. be 4f
  389. andcc %o1, 2, %g0
  390. ldub [%o1], %g2
  391. add %o1, 1, %o1
  392. stb %g2, [%o0]
  393. sub %o2, 1, %o2
  394. bne 3f
  395. add %o0, 1, %o0
  396. 4: lduh [%o1], %g2
  397. add %o1, 2, %o1
  398. sth %g2, [%o0]
  399. sub %o2, 2, %o2
  400. b 3f
  401. add %o0, 2, %o0
  402. END(__memmove)
  403. strong_alias(__memmove,memmove)
  404. ENTRY(__memcpy) /* %o0=dst %o1=src %o2=len */
  405. sub %o0, %o1, %o4
  406. st %o0, [%sp + 64]
  407. 9: andcc %o4, 3, %o5
  408. 0: bne 86f
  409. cmp %o2, 15
  410. bleu 90f
  411. andcc %o1, 3, %g0
  412. bne 78b
  413. 3: andcc %o1, 4, %g0
  414. be 2f
  415. mov %o2, %g1
  416. ld [%o1], %o4
  417. sub %g1, 4, %g1
  418. st %o4, [%o0]
  419. add %o1, 4, %o1
  420. add %o0, 4, %o0
  421. 2: andcc %g1, 0xffffff80, %g6
  422. be 3f
  423. andcc %o0, 4, %g0
  424. be 82f + 4
  425. 5: MOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
  426. MOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
  427. MOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
  428. MOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
  429. subcc %g6, 128, %g6
  430. add %o1, 128, %o1
  431. bne 5b
  432. add %o0, 128, %o0
  433. 3: andcc %g1, 0x70, %g6
  434. be 80f
  435. andcc %g1, 8, %g0
  436. srl %g6, 1, %o4
  437. mov %o7, %g2
  438. add %g6, %o4, %o4
  439. add %o1, %g6, %o1
  440. 104: call 100f
  441. add %o0, %g6, %o0
  442. jmpl %o5 + (80f - 104b), %g0
  443. mov %g2, %o7
  444. 79: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
  445. MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
  446. MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
  447. MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
  448. MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
  449. MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
  450. MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
  451. 80: be 81f
  452. andcc %g1, 4, %g0
  453. ldd [%o1], %g2
  454. add %o0, 8, %o0
  455. st %g2, [%o0 - 0x08]
  456. add %o1, 8, %o1
  457. st %g3, [%o0 - 0x04]
  458. 81: be 1f
  459. andcc %g1, 2, %g0
  460. ld [%o1], %g2
  461. add %o1, 4, %o1
  462. st %g2, [%o0]
  463. add %o0, 4, %o0
  464. 1: be 1f
  465. andcc %g1, 1, %g0
  466. lduh [%o1], %g2
  467. add %o1, 2, %o1
  468. sth %g2, [%o0]
  469. add %o0, 2, %o0
  470. 1: be 1f
  471. nop
  472. ldub [%o1], %g2
  473. stb %g2, [%o0]
  474. 1: retl
  475. ld [%sp + 64], %o0
  476. 82: /* ldd_std */
  477. MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
  478. MOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
  479. MOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
  480. MOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
  481. subcc %g6, 128, %g6
  482. add %o1, 128, %o1
  483. bne 82b
  484. add %o0, 128, %o0
  485. andcc %g1, 0x70, %g6
  486. be 84f
  487. andcc %g1, 8, %g0
  488. mov %o7, %g2
  489. 111: call 110f
  490. add %o1, %g6, %o1
  491. mov %g2, %o7
  492. jmpl %o5 + (84f - 111b), %g0
  493. add %o0, %g6, %o0
  494. 83: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
  495. MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
  496. MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
  497. MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
  498. MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
  499. MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
  500. MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
  501. 84: be 85f
  502. andcc %g1, 4, %g0
  503. ldd [%o1], %g2
  504. add %o0, 8, %o0
  505. std %g2, [%o0 - 0x08]
  506. add %o1, 8, %o1
  507. 85: be 1f
  508. andcc %g1, 2, %g0
  509. ld [%o1], %g2
  510. add %o1, 4, %o1
  511. st %g2, [%o0]
  512. add %o0, 4, %o0
  513. 1: be 1f
  514. andcc %g1, 1, %g0
  515. lduh [%o1], %g2
  516. add %o1, 2, %o1
  517. sth %g2, [%o0]
  518. add %o0, 2, %o0
  519. 1: be 1f
  520. nop
  521. ldub [%o1], %g2
  522. stb %g2, [%o0]
  523. 1: retl
  524. ld [%sp + 64], %o0
  525. 86: cmp %o2, 6
  526. bleu 88f
  527. cmp %o2, 256
  528. bcc 87f
  529. andcc %o0, 3, %g0
  530. be 61f
  531. andcc %o0, 1, %g0
  532. be 60f
  533. andcc %o0, 2, %g0
  534. ldub [%o1], %g5
  535. add %o1, 1, %o1
  536. stb %g5, [%o0]
  537. sub %o2, 1, %o2
  538. bne 61f
  539. add %o0, 1, %o0
  540. 60: ldub [%o1], %g3
  541. add %o1, 2, %o1
  542. stb %g3, [%o0]
  543. sub %o2, 2, %o2
  544. ldub [%o1 - 1], %g3
  545. add %o0, 2, %o0
  546. stb %g3, [%o0 - 1]
  547. 61: and %o1, 3, %g2
  548. and %o2, 0xc, %g3
  549. and %o1, -4, %o1
  550. cmp %g3, 4
  551. sll %g2, 3, %g4
  552. mov 32, %g2
  553. be 4f
  554. sub %g2, %g4, %g6
  555. blu 3f
  556. cmp %g3, 0x8
  557. be 2f
  558. srl %o2, 2, %g3
  559. ld [%o1], %o3
  560. add %o0, -8, %o0
  561. ld [%o1 + 4], %o4
  562. b 8f
  563. add %g3, 1, %g3
  564. 2: ld [%o1], %o4
  565. add %o0, -12, %o0
  566. ld [%o1 + 4], %o5
  567. add %g3, 2, %g3
  568. b 9f
  569. add %o1, -4, %o1
  570. 3: ld [%o1], %g1
  571. add %o0, -4, %o0
  572. ld [%o1 + 4], %o3
  573. srl %o2, 2, %g3
  574. b 7f
  575. add %o1, 4, %o1
  576. 4: ld [%o1], %o5
  577. cmp %o2, 7
  578. ld [%o1 + 4], %g1
  579. srl %o2, 2, %g3
  580. bleu 10f
  581. add %o1, 8, %o1
  582. ld [%o1], %o3
  583. add %g3, -1, %g3
  584. 5: sll %o5, %g4, %g2
  585. srl %g1, %g6, %g5
  586. or %g2, %g5, %g2
  587. st %g2, [%o0]
  588. 7: ld [%o1 + 4], %o4
  589. sll %g1, %g4, %g2
  590. srl %o3, %g6, %g5
  591. or %g2, %g5, %g2
  592. st %g2, [%o0 + 4]
  593. 8: ld [%o1 + 8], %o5
  594. sll %o3, %g4, %g2
  595. srl %o4, %g6, %g5
  596. or %g2, %g5, %g2
  597. st %g2, [%o0 + 8]
  598. 9: ld [%o1 + 12], %g1
  599. sll %o4, %g4, %g2
  600. srl %o5, %g6, %g5
  601. addcc %g3, -4, %g3
  602. or %g2, %g5, %g2
  603. add %o1, 16, %o1
  604. st %g2, [%o0 + 12]
  605. add %o0, 16, %o0
  606. bne,a 5b
  607. ld [%o1], %o3
  608. 10: sll %o5, %g4, %g2
  609. srl %g1, %g6, %g5
  610. srl %g6, 3, %g3
  611. or %g2, %g5, %g2
  612. sub %o1, %g3, %o1
  613. andcc %o2, 2, %g0
  614. st %g2, [%o0]
  615. be 1f
  616. andcc %o2, 1, %g0
  617. ldub [%o1], %g2
  618. add %o1, 2, %o1
  619. stb %g2, [%o0 + 4]
  620. add %o0, 2, %o0
  621. ldub [%o1 - 1], %g2
  622. stb %g2, [%o0 + 3]
  623. 1: be 1f
  624. nop
  625. ldub [%o1], %g2
  626. stb %g2, [%o0 + 4]
  627. 1: retl
  628. ld [%sp + 64], %o0
  629. 87: andcc %o1, 3, %g0
  630. be 3f
  631. andcc %o1, 1, %g0
  632. be 4f
  633. andcc %o1, 2, %g0
  634. ldub [%o1], %g2
  635. add %o1, 1, %o1
  636. stb %g2, [%o0]
  637. sub %o2, 1, %o2
  638. bne 3f
  639. add %o0, 1, %o0
  640. 4: lduh [%o1], %g2
  641. add %o1, 2, %o1
  642. srl %g2, 8, %g3
  643. sub %o2, 2, %o2
  644. stb %g3, [%o0]
  645. add %o0, 2, %o0
  646. stb %g2, [%o0 - 1]
  647. 3: andcc %o1, 4, %g0
  648. bne 2f
  649. cmp %o5, 1
  650. ld [%o1], %o4
  651. srl %o4, 24, %g2
  652. stb %g2, [%o0]
  653. srl %o4, 16, %g3
  654. stb %g3, [%o0 + 1]
  655. srl %o4, 8, %g2
  656. stb %g2, [%o0 + 2]
  657. sub %o2, 4, %o2
  658. stb %o4, [%o0 + 3]
  659. add %o1, 4, %o1
  660. add %o0, 4, %o0
  661. 2: be 33f
  662. cmp %o5, 2
  663. be 32f
  664. sub %o2, 4, %o2
  665. 31: ld [%o1], %g2
  666. add %o1, 4, %o1
  667. srl %g2, 24, %g3
  668. and %o0, 7, %g5
  669. stb %g3, [%o0]
  670. cmp %g5, 7
  671. sll %g2, 8, %g1
  672. add %o0, 4, %o0
  673. be 41f
  674. and %o2, 0xffffffc0, %o3
  675. ld [%o0 - 7], %o4
  676. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  677. SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  678. SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  679. SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  680. subcc %o3, 64, %o3
  681. add %o1, 64, %o1
  682. bne 4b
  683. add %o0, 64, %o0
  684. andcc %o2, 0x30, %o3
  685. be,a 1f
  686. srl %g1, 16, %g2
  687. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  688. subcc %o3, 16, %o3
  689. add %o1, 16, %o1
  690. bne 4b
  691. add %o0, 16, %o0
  692. srl %g1, 16, %g2
  693. 1: st %o4, [%o0 - 7]
  694. sth %g2, [%o0 - 3]
  695. srl %g1, 8, %g4
  696. b 88f
  697. stb %g4, [%o0 - 1]
  698. 32: ld [%o1], %g2
  699. add %o1, 4, %o1
  700. srl %g2, 16, %g3
  701. and %o0, 7, %g5
  702. sth %g3, [%o0]
  703. cmp %g5, 6
  704. sll %g2, 16, %g1
  705. add %o0, 4, %o0
  706. be 42f
  707. and %o2, 0xffffffc0, %o3
  708. ld [%o0 - 6], %o4
  709. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  710. SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  711. SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  712. SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  713. subcc %o3, 64, %o3
  714. add %o1, 64, %o1
  715. bne 4b
  716. add %o0, 64, %o0
  717. andcc %o2, 0x30, %o3
  718. be,a 1f
  719. srl %g1, 16, %g2
  720. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  721. subcc %o3, 16, %o3
  722. add %o1, 16, %o1
  723. bne 4b
  724. add %o0, 16, %o0
  725. srl %g1, 16, %g2
  726. 1: st %o4, [%o0 - 6]
  727. b 88f
  728. sth %g2, [%o0 - 2]
  729. 33: ld [%o1], %g2
  730. sub %o2, 4, %o2
  731. srl %g2, 24, %g3
  732. and %o0, 7, %g5
  733. stb %g3, [%o0]
  734. cmp %g5, 5
  735. srl %g2, 8, %g4
  736. sll %g2, 24, %g1
  737. sth %g4, [%o0 + 1]
  738. add %o1, 4, %o1
  739. be 43f
  740. and %o2, 0xffffffc0, %o3
  741. ld [%o0 - 1], %o4
  742. add %o0, 4, %o0
  743. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
  744. SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
  745. SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
  746. SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
  747. subcc %o3, 64, %o3
  748. add %o1, 64, %o1
  749. bne 4b
  750. add %o0, 64, %o0
  751. andcc %o2, 0x30, %o3
  752. be,a 1f
  753. srl %g1, 24, %g2
  754. 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
  755. subcc %o3, 16, %o3
  756. add %o1, 16, %o1
  757. bne 4b
  758. add %o0, 16, %o0
  759. srl %g1, 24, %g2
  760. 1: st %o4, [%o0 - 5]
  761. b 88f
  762. stb %g2, [%o0 - 1]
  763. 41: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  764. SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  765. SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  766. SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  767. subcc %o3, 64, %o3
  768. add %o1, 64, %o1
  769. bne 41b
  770. add %o0, 64, %o0
  771. andcc %o2, 0x30, %o3
  772. be,a 1f
  773. srl %g1, 16, %g2
  774. 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
  775. subcc %o3, 16, %o3
  776. add %o1, 16, %o1
  777. bne 4b
  778. add %o0, 16, %o0
  779. srl %g1, 16, %g2
  780. 1: sth %g2, [%o0 - 3]
  781. srl %g1, 8, %g4
  782. b 88f
  783. stb %g4, [%o0 - 1]
  784. 43: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
  785. SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
  786. SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
  787. SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
  788. subcc %o3, 64, %o3
  789. add %o1, 64, %o1
  790. bne 43b
  791. add %o0, 64, %o0
  792. andcc %o2, 0x30, %o3
  793. be,a 1f
  794. srl %g1, 24, %g2
  795. 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
  796. subcc %o3, 16, %o3
  797. add %o1, 16, %o1
  798. bne 4b
  799. add %o0, 16, %o0
  800. srl %g1, 24, %g2
  801. 1: stb %g2, [%o0 + 3]
  802. b 88f
  803. add %o0, 4, %o0
  804. 42: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  805. SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  806. SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  807. SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  808. subcc %o3, 64, %o3
  809. add %o1, 64, %o1
  810. bne 42b
  811. add %o0, 64, %o0
  812. andcc %o2, 0x30, %o3
  813. be,a 1f
  814. srl %g1, 16, %g2
  815. 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
  816. subcc %o3, 16, %o3
  817. add %o1, 16, %o1
  818. bne 4b
  819. add %o0, 16, %o0
  820. srl %g1, 16, %g2
  821. 1: sth %g2, [%o0 - 2]
  822. /* Fall through */
  823. 88: and %o2, 0xe, %o3
  824. mov %o7, %g2
  825. sll %o3, 3, %o4
  826. add %o0, %o3, %o0
  827. 106: call 100f
  828. add %o1, %o3, %o1
  829. mov %g2, %o7
  830. jmpl %o5 + (89f - 106b), %g0
  831. andcc %o2, 1, %g0
  832. MOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
  833. MOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
  834. MOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
  835. MOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
  836. MOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
  837. MOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
  838. MOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
  839. 89: be 1f
  840. nop
  841. ldub [%o1], %g2
  842. stb %g2, [%o0]
  843. 1: retl
  844. ld [%sp + 64], %o0
  845. 90: bne 88b
  846. andcc %o2, 8, %g0
  847. be 1f
  848. andcc %o2, 4, %g0
  849. ld [%o1 + 0x00], %g2
  850. ld [%o1 + 0x04], %g3
  851. add %o1, 8, %o1
  852. st %g2, [%o0 + 0x00]
  853. st %g3, [%o0 + 0x04]
  854. add %o0, 8, %o0
  855. 1: b 81b
  856. mov %o2, %g1
  857. 100: retl
  858. sub %o7, %o4, %o5
  859. 110: retl
  860. sub %o7, %g6, %o5
  861. END(__memcpy)
  862. strong_alias(__memcpy,memcpy)