fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / machine / h8300 / strcmp.S
blob2ee31f05ca8216e48dd3a0ff31d31fbd4fe2039f
1 #include "setarch.h"
3 #include "defines.h"
5         .section .text
6         .align 2
7         .global _strcmp
8 _strcmp:
9         MOVP    A0P,A2P
10         MOVP    A1P,A3P
11 .L5:
12         mov.b   @A2P+,A1L
13         beq     .L3
14         mov.b   @A3P+,A0L
15         cmp.b   A0L,A1L
16         beq     .L5
17 #ifdef __NORMAL_MODE__
18         sub     #1,A3P
19 #else
20         subs    #1,A3P
21 #endif
22 .L3:
23         mov.b   @(-1,A2P),A0L
24         mov.b   @A3P,A1L
25         sub.b   A1L,A0L
26         ; We have to sign extend the result to 32bits just in case
27         ; we are using 32bit integers.
28 #ifdef __H8300H__
29         exts.w  r0
30         exts.l  er0
31 #else
32 #ifdef __H8300S__
33         exts.w  r0
34         exts.l  er0
35 #else
36         bld     #7,r0l
37         subx    r0h,r0h
38         subx    r1l,r1l
39         subx    r1h,r1h
40 #endif
41 #endif
42         rts
43         .end