/*1* Copyright (C) 2004-2006 Atmel Corporation2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License version 2 as5* published by the Free Software Foundation.6*/78/*9* void *memcpy(void *to, const void *from, unsigned long n)10*11* This implementation does word-aligned loads in the main loop,12* possibly sacrificing alignment of stores.13*14* Hopefully, in most cases, both "to" and "from" will be15* word-aligned to begin with.16*/17.text18.global memcpy19.type memcpy, @function20memcpy:21mov r9, r1122andl r9, 3, COH23brne 1f2425/* At this point, "from" is word-aligned */262: mov r9, r12275: sub r10, 428brlt 4f29303: ld.w r8, r11++31sub r10, 432st.w r12++, r833brge 3b34354: neg r1036reteq r93738/* Handle unaligned count */39lsl r10, 240add pc, pc, r1041ld.ub r8, r11++42st.b r12++, r843ld.ub r8, r11++44st.b r12++, r845ld.ub r8, r11++46st.b r12++, r847retal r94849/* Handle unaligned "from" pointer */501: sub r10, 451movlt r9, r1252brlt 4b53add r10, r954lsl r9, 255add pc, pc, r956ld.ub r8, r11++57st.b r12++, r858ld.ub r8, r11++59st.b r12++, r860ld.ub r8, r11++61st.b r12++, r862mov r8, r1263add pc, pc, r964sub r8, 165nop66sub r8, 167nop68sub r8, 169nop70mov r9, r871rjmp 5b727374