OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [string/] [sh64/] [strcpy.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
2
/* Modified by SuperH, Inc. September 2003 */
3
! Entry: arg0: destination
4
!        arg1: source
5
! Exit:  result: destination
6
!
7
! SH5 code Copyright 2002 SuperH Ltd.
8
 
9
#ifdef __LITTLE_ENDIAN__
10
#define SHHI shlld
11
#define SHLO shlrd
12
#else
13
#define SHHI shlrd
14
#define SHLO shlld
15
#endif
16
 
17
        .section .text..SHmedia32,"ax"
18
        .globl  strcpy
19
        .type   strcpy, @function
20
 
21
        .align 5
22
strcpy:
23
 
24
        pta/l shortstring,tr1
25
        ldlo.q r3,0,r4
26
        ptabs r18,tr4
27
        shlli r3,3,r7
28
        addi r2, 8, r0
29
        mcmpeq.b r4,r63,r6
30
        SHHI r6,r7,r6
31
        bnei/u r6,0,tr1 // shortstring
32
        pta/l no_lddst, tr2
33
        ori r3,-8,r23
34
        sub r2, r23, r0
35
        sub r3, r2, r21
36
        addi r21, 8, r20
37
        ldx.q r0, r21, r5
38
        pta/l loop, tr0
39
        ori r2,-8,r22
40
        mcmpeq.b r5, r63, r6
41
        bgt/u r22, r23, tr2 // no_lddst
42
 
43
        // r22 < r23 :  Need to do a load from the destination.
44
        // r22 == r23 : Doesn't actually need to load from destination,
45
        //              but still can be handled here.
46
        ldlo.q r2, 0, r9
47
        movi -1, r8
48
        SHLO r8, r7, r8
49
        mcmv r4, r8, r9
50
        stlo.q r2, 0, r9
51
        beqi/l r6, 0, tr0 // loop
52
 
53
        add r5, r63, r4
54
        addi r0, 8, r0
55
        blink tr1, r63 // shortstring
56
no_lddst:
57
        // r22 > r23: note that for r22 == r23 the sthi.q would clobber
58
        //            bytes before the destination region.
59
        stlo.q r2, 0, r4
60
        SHHI r4, r7, r4
61
        sthi.q r0, -1, r4
62
        beqi/l r6, 0, tr0 // loop
63
 
64
        add r5, r63, r4
65
        addi r0, 8, r0
66
shortstring:
67
#ifndef __LITTLE_ENDIAN__
68
        pta/l shortstring2,tr1
69
        byterev r4,r4
70
#endif
71
shortstring2:
72
        st.b r0,-8,r4
73
        andi r4,0xff,r5
74
        shlri r4,8,r4
75
        addi r0,1,r0
76
        bnei/l r5,0,tr1
77
        blink tr4,r63 // return
78
 
79
        .balign 8
80
loop:
81
        stlo.q r0, 0, r5
82
        ldx.q r0, r20, r4
83
        addi r0, 16, r0
84
        sthi.q r0, -9, r5
85
        mcmpeq.b r4, r63, r6
86
        bnei/u r6, 0, tr1 // shortstring
87
        ldx.q r0, r21, r5
88
        stlo.q r0, -8, r4
89
        sthi.q r0, -1, r4
90
        mcmpeq.b r5, r63, r6
91
        beqi/l r6, 0, tr0 // loop
92
 
93
        add r5, r63, r4
94
        addi r0, 8, r0
95
        blink tr1, r63 // shortstring
96
 
97
        .size   strcpy, . - strcpy
98
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.