1/* 2Copyright (c) 2009 Nick Clifton <nickc@redhat.com> 3 */ 4 .file "strcmp.S" 5 6 .section .text 7 8 .global _strcmp 9 .type _strcmp,@function 10_strcmp: 11#ifdef __RX_DISALLOW_STRING_INSNS__ 122: mov.b [r1+], r4 13 mov.b [r2+], r5 14 cmp #0, r4 15 beq 3f 16 cmp #0, r5 17 beq 3f 18 cmp r4, r5 19 beq 2b 20 213: and #0xff, r4 ; We need to perform an unsigned comparison of the bytes. 22 and #0xff, r5 23 sub r5, r4, r1 24 rts 25#else 26 mov #-1, r3 ; Strictly speaking this is incorrect, but I doubt if anyone will ever know. 27 scmpu ; Perform the string comparison 28 bnc 1f ; If Carry is not set skip over 29 scne.L r1 ; Set result based on Z flag 30 rts ; 311: ; 32 mov #-1,r1 ; Carry not set, result should be negative 33 rts ; 34#endif 35 .size _strcmp, . - _strcmp 36 37