4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-16 19:40:07 +08:00
Nick Clifton cd0d459135 For the RX port, avoid using string instructions when __RX_DISALLOW_STRING_INSNS__ is defined.
* rx/crt0.S (_start): If string instructions are not allowed,
	avoid using SMOVF.

	* libc/machine/rx/memchr.S: Add non-string insn using version.
	* libc/machine/rx/memcpy.S: Likewise.
	* libc/machine/rx/memmove.S: Likewise.
	* libc/machine/rx/mempcpy.S: Likewise.
	* libc/machine/rx/strcat.S: Likewise.
	* libc/machine/rx/strcmp.S: Likewise.
	* libc/machine/rx/strcpy.S: Likewise.
	* libc/machine/rx/strlen.S: Likewise.
	* libc/machine/rx/strncat.S: Likewise.
	* libc/machine/rx/strncmp.S: Likewise.
	* libc/machine/rx/strncpy.S: Likewise.
2015-04-23 21:57:13 +02:00

34 lines
673 B
ArmAsm

.file "strcmp.S"
.section .text
.global _strcmp
.type _strcmp,@function
_strcmp:
#ifdef __RX_DISALLOW_STRING_INSNS__
2: mov.b [r1+], r4
mov.b [r2+], r5
cmp #0, r4
beq 3f
cmp #0, r5
beq 3f
cmp r4, r5
beq 2b
3: and #0xff, r4 ; We need to perform an unsigned comparison of the bytes.
and #0xff, r5
sub r5, r4, r1
rts
#else
mov #-1, r3 ; Strictly speaking this is incorrect, but I doubt if anyone will ever know.
scmpu ; Perform the string comparison
bnc 1f ; If Carry is not set skip over
scne.L r1 ; Set result based on Z flag
rts ;
1: ;
mov #-1,r1 ; Carry not set, result should be negative
rts ;
#endif
.size _strcmp, . - _strcmp