Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-02-17 22:39:52 +0300
committerChristopher Faylor <me@cgf.cx>2000-02-17 22:39:52 +0300
commit8a0efa53e44919bcf5ccb1d3353618a82afdf8bc (patch)
tree68c3dbf3f2c6fd5d49777def9914d77b5cd4589d /newlib/libc/machine/sh/strcmp.S
parent1fd5e000ace55b323124c7e556a7a864b972a5c4 (diff)
import newlib-2000-02-17 snapshot
Diffstat (limited to 'newlib/libc/machine/sh/strcmp.S')
-rw-r--r--newlib/libc/machine/sh/strcmp.S66
1 files changed, 66 insertions, 0 deletions
diff --git a/newlib/libc/machine/sh/strcmp.S b/newlib/libc/machine/sh/strcmp.S
new file mode 100644
index 000000000..a112b13e0
--- /dev/null
+++ b/newlib/libc/machine/sh/strcmp.S
@@ -0,0 +1,66 @@
+! Entry: r4: destination
+! r5: source
+! Exit: r0: result
+! r1-r2,r4-r5: clobbered
+
+#include "asm.h"
+
+ENTRY(strcmp)
+ mov r4,r0
+ or r5,r0
+ tst #3,r0
+ bf L_setup_char_loop
+ mov #0,r0
+#ifdef DELAYED_BRANCHES
+ mov.l @r4+,r1
+ .align 2
+Longword_loop:
+ mov.l @r5+,r2
+ cmp/str r0,r1
+ bt Longword_loop_end
+ cmp/eq r1,r2
+ bt.s Longword_loop
+ mov.l @r4+,r1
+ add #-4, r4
+Longword_loop_end:
+ add #-4, r4
+ add #-4, r5
+L_setup_char_loop:
+ mov.b @r4+,r0
+ .align 2
+L_char_loop:
+ mov.b @r5+,r1
+ tst r0,r0
+ bt L_return
+ cmp/eq r0,r1
+ bt.s L_char_loop
+ mov.b @r4+,r0
+ add #-2,r4
+ mov.b @r4,r0
+#else /* ! DELAYED_BRANCHES */
+ .align 2
+Longword_loop:
+ mov.l @r4+,r1
+ mov.l @r5+,r2
+ cmp/str r0,r1
+ bt Longword_loop_end
+ cmp/eq r1,r2
+ bt Longword_loop
+Longword_loop_end:
+ add #-4, r4
+ add #-4, r5
+ .align 2
+L_setup_char_loop:
+L_char_loop:
+ mov.b @r4+,r0
+ mov.b @r5+,r1
+ tst r0,r0
+ bt L_return
+ cmp/eq r0,r1
+ bt L_char_loop
+#endif
+L_return:
+ extu.b r0,r0
+ extu.b r1,r1
+ rts
+ sub r1,r0