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#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) 13.section .text.memcpy 14.global memcpy 15.type memcpy, @function 16memcpy: 17 mv t1, a0 18 beqz a2, 2f 19 201: 21 lb t2, 0(a1) 22 sb t2, 0(t1) 23 add a2, a2, -1 24 add t1, t1, 1 25 add a1, a1, 1 26 bnez a2, 1b 27 282: 29 ret 30 31 .size memcpy, .-memcpy 32#endif 33