123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- /*
- * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
- * in this tarball.
- */
- #include <features.h>
- #include <endian.h>
- #ifdef WANT_WIDE
- # define Wstrcpy wcscpy
- #else
- # define Wstrcpy strcpy
- #endif
- .align 2
- .global Wstrcpy
- .type Wstrcpy, @function
- Wstrcpy:
- mov r6, r2
- mov r7, r3
- or r7, r6
- andi r7, 3
- cmpnei r7, 0
- bf 2f
- 1:
- ldb r5, (r3)
- stb r5, (r6)
- addi r3, 1
- addi r6, 1
- cmpnei r5, 0
- bt 1b
- 1:
- jmp r15
- 2:
- ldw r5, (r3)
- tstnbz r5
- bf 10f
- stw r5, (r6)
- ldw r5, (r3, 4)
- tstnbz r5
- bf 3f
- stw r5, (r6, 4)
- ldw r5, (r3, 8)
- tstnbz r5
- bf 4f
- stw r5, (r6, 8)
- ldw r5, (r3, 12)
- tstnbz r5
- bf 5f
- stw r5, (r6, 12)
- ldw r5, (r3, 16)
- tstnbz r5
- bf 6f
- stw r5, (r6, 16)
- ldw r5, (r3, 20)
- tstnbz r5
- bf 7f
- stw r5, (r6, 20)
- ldw r5, (r3, 24)
- tstnbz r5
- bf 8f
- stw r5, (r6, 24)
- ldw r5, (r3, 28)
- tstnbz r5
- bf 9f
- stw r5, (r6, 28)
- addi r6, 32
- addi r3, 32
- br 2b
- 3:
- addi r6, 4
- br 10f
- 4:
- addi r6, 8
- br 10f
- 5:
- addi r6, 12
- br 10f
- 6:
- addi r6, 16
- br 10f
- 7:
- addi r6, 20
- br 10f
- 8:
- addi r6, 24
- br 10f
- 9:
- addi r6, 28
- 10:
- #ifdef __CSKYBE__
- xtrb0 r1, r5
- stb r1, (r6)
- cmpnei r1, 0
- bf 5f
- xtrb1 r1, r5
- stb r1, (r6, 1)
- cmpnei r1, 0
- bf 5f
- xtrb2 r1, r5
- stb r1, (r6, 2 )
- cmpnei r1, 0
- bf 5f
- stw r5, (r6)
- #else
- xtrb3 r1, r5
- stb r1, (r6)
- cmpnei r1, 0
- bf 5f
- xtrb2 r1, r5
- stb r1, (r6, 1)
- cmpnei r1, 0
- bf 5f
- xtrb1 r1, r5
- stb r1, (r6, 2)
- cmpnei r1, 0
- bf 5f
- stw r5, (r6)
- #endif
- 5:
- jmp r15
- libc_hidden_def(Wstrcpy)
- .weak Wstrcpy
|