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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [machine/] [sh/] [strcmp.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1009 ivang
! Entry: r4: destination
2
!        r5: source
3
! Exit:  r0: result
4
!        r1-r2,r4-r5: clobbered
5
 
6
#include "asm.h"
7
 
8
ENTRY(strcmp)
9
        mov     r4,r0
10
        or      r5,r0
11
        tst     #3,r0
12
        bf      L_setup_char_loop
13
        mov     #0,r0
14
#ifdef DELAYED_BRANCHES
15
        mov.l   @r4+,r1
16
        .align  2
17
Longword_loop:
18
        mov.l   @r5+,r2
19
        cmp/str r0,r1
20
        bt      Longword_loop_end
21
        cmp/eq  r1,r2
22
        bt.s    Longword_loop
23
        mov.l   @r4+,r1
24
        add #-4, r4
25
Longword_loop_end:
26
        add #-4, r4
27
        add #-4, r5
28
L_setup_char_loop:
29
        mov.b   @r4+,r0
30
        .align  2
31
L_char_loop:
32
        mov.b   @r5+,r1
33
        tst     r0,r0
34
        bt      L_return
35
        cmp/eq  r0,r1
36
        bt.s L_char_loop
37
        mov.b   @r4+,r0
38
        add     #-2,r4
39
        mov.b   @r4,r0
40
#else /* ! DELAYED_BRANCHES */
41
        .align  2
42
Longword_loop:
43
        mov.l   @r4+,r1
44
        mov.l   @r5+,r2
45
        cmp/str r0,r1
46
        bt      Longword_loop_end
47
        cmp/eq  r1,r2
48
        bt      Longword_loop
49
Longword_loop_end:
50
        add #-4, r4
51
        add #-4, r5
52
        .align  2
53
L_setup_char_loop:
54
L_char_loop:
55
        mov.b   @r4+,r0
56
        mov.b   @r5+,r1
57
        tst     r0,r0
58
        bt      L_return
59
        cmp/eq  r0,r1
60
        bt L_char_loop
61
#endif
62
L_return:
63
        extu.b  r0,r0
64
        extu.b  r1,r1
65
        rts
66
        sub     r1,r0

powered by: WebSVN 2.1.0

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