source: trunk/libs/newlib/src/newlib/libc/machine/h8300/strcmp.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 779 bytes
Line 
1#include "setarch.h"
2
3#include "defines.h"
4
5#if defined (__H8300SX__)
6        .global _strcmp
7_strcmp:
8        mov.l   er0,er2
9loop:
10        mov.b   @er2+,r0l
11        beq     eos
12        sub.b   @er1+,r0l
13        beq     loop
14        exts.l  #2,er0
15        rts
16eos:
17        sub.b   @er1,r0l
18        exts.l  #2,er0
19        rts
20#else
21        .section .text
22        .align 2
23        .global _strcmp
24_strcmp:
25        MOVP    A0P,A2P
26        MOVP    A1P,A3P
27.L5:
28        mov.b   @A2P+,A1L
29        beq     .L3
30        mov.b   @A3P+,A0L
31        cmp.b   A0L,A1L
32        beq     .L5
33#ifdef __NORMAL_MODE__
34        sub     #1,A3P
35#else
36        subs    #1,A3P
37#endif
38.L3:
39        mov.b   @(-1,A2P),A0L
40        mov.b   @A3P,A1L
41        sub.b   A1L,A0L
42        ; We have to sign extend the result to 32bits just in case
43        ; we are using 32bit integers.
44#ifdef __H8300H__
45        exts.w  r0
46        exts.l  er0
47#else
48#ifdef __H8300S__
49        exts.w  r0
50        exts.l  er0
51#else
52        bld     #7,r0l
53        subx    r0h,r0h
54        subx    r1l,r1l
55        subx    r1h,r1h
56#endif
57#endif
58        rts
59        .end
60#endif
Note: See TracBrowser for help on using the repository browser.