1/*
2Copyright (c) 2009 Nick Clifton <nickc@redhat.com>
3 */
4#include <picolibc.h>
5
6	.file	"strcpy.S"
7
8	.section .text
9	.global  _strcpy
10	.type	 _strcpy,@function
11_strcpy:
12	;; R1: dest
13	;; R2: source
14#ifdef __RX_DISALLOW_STRING_INSNS__
15	mov	r1, r4		; Leave the destination address unchanged in the result register.
16
171:	mov.b	[r2+], r5
18	mov.b	r5, [r4+]
19	cmp	#0, r5
20	bne	1b
21
22	rts
23#else
24	mov	r1, r4
25	mov	#-1, r3		; Strictly speaking this is incorrect, but I doubt if anyone will ever know.
26	smovu
27	mov	r4, r1
28	rts
29#endif
30	.size _strcpy, . - _strcpy
31