/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)3*/45/* If dst and src are 4 byte aligned, copy 8 bytes at a time.6If the src is 4, but not 8 byte aligned, we first read 4 bytes to get7it 8 byte aligned. Thus, we can do a little read-ahead, without8dereferencing a cache line that we should not touch.9Note that short and long instructions have been scheduled to avoid10branch stalls.11The beq_s to r3z could be made unaligned & long to avoid a stall12there, but the it is not likely to be taken often, and it13would also be likey to cost an unaligned mispredict at the next call. */1415#include <linux/linkage.h>1617ENTRY_CFI(strcpy)18or r2,r0,r119bmsk_s r2,r2,120brne.d r2,0,charloop21mov_s r10,r022ld_s r3,[r1,0]23mov r8,0x0101010124bbit0.d r1,2,loop_start25ror r12,r826sub r2,r3,r827bic_s r2,r2,r328tst_s r2,r1229bne r3z30mov_s r4,r331.balign 432loop:33ld.a r3,[r1,4]34st.ab r4,[r10,4]35loop_start:36ld.a r4,[r1,4]37sub r2,r3,r838bic_s r2,r2,r339tst_s r2,r1240bne_s r3z41st.ab r3,[r10,4]42sub r2,r4,r843bic r2,r2,r444tst r2,r1245beq loop46mov_s r3,r447#ifdef __LITTLE_ENDIAN__48r3z: bmsk.f r1,r3,749lsr_s r3,r3,850#else51r3z: lsr.f r1,r3,2452asl_s r3,r3,853#endif54bne.d r3z55stb.ab r1,[r10,1]56j_s [blink]5758.balign 459charloop:60ldb.ab r3,[r1,1]616263brne.d r3,0,charloop64stb.ab r3,[r10,1]65j [blink]66END_CFI(strcpy)676869