1/* Copyright (c) 2019 SiFive Inc. All rights reserved. 2 3 This copyrighted material is made available to anyone wishing to use, 4 modify, copy, or redistribute it subject to the terms and conditions 5 of the FreeBSD License. This program is distributed in the hope that 6 it will be useful, but WITHOUT ANY WARRANTY expressed or implied, 7 including the implied warranties of MERCHANTABILITY or FITNESS FOR 8 A PARTICULAR PURPOSE. A copy of this license is available at 9 http://www.opensource.org/licenses. 10*/ 11 12#include <picolibc.h> 13 14#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) 15.section .text.memcpy 16.global memcpy 17.type memcpy, @function 18memcpy: 19 mv t1, a0 20 beqz a2, 2f 21 221: 23 lb t2, 0(a1) 24 sb t2, 0(t1) 25 add a2, a2, -1 26 add t1, t1, 1 27 add a1, a1, 1 28 bnez a2, 1b 29 302: 31 ret 32 33 .size memcpy, .-memcpy 34#endif 35