summaryrefslogtreecommitdiff
path: root/libc/string/bfin
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/bfin')
-rw-r--r--libc/string/bfin/memchr.S24
-rw-r--r--libc/string/bfin/memcmp.S94
-rw-r--r--libc/string/bfin/memcpy.S74
-rw-r--r--libc/string/bfin/memmove.S97
-rw-r--r--libc/string/bfin/memset.S88
-rw-r--r--libc/string/bfin/strcmp.S38
6 files changed, 221 insertions, 194 deletions
diff --git a/libc/string/bfin/memchr.S b/libc/string/bfin/memchr.S
index 23626d6a4..c264ad3d1 100644
--- a/libc/string/bfin/memchr.S
+++ b/libc/string/bfin/memchr.S
@@ -1,5 +1,5 @@
/* memchr.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* void *memchr(const void *s, int c, size_t n);
* R0 = address (s)
* R1 = sought byte (c)
@@ -21,30 +23,28 @@
.align 2
-.global _memchr
-.type _memchr, STT_FUNC
-_memchr:
+ENTRY(_memchr)
P0 = R0; // P0 = address
P2 = R2; // P2 = count
R1 = R1.B(Z);
CC = R2 == 0;
- IF CC JUMP failed;
+ IF CC JUMP .Lfailed;
-bytes:
- LSETUP (byte_loop_s , byte_loop_e) LC0=P2;
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
-byte_loop_s:
+.Lbyte_loop_s:
R3 = B[P0++](Z);
CC = R3 == R1;
- IF CC JUMP found;
-byte_loop_e:
+ IF CC JUMP .Lfound;
+.Lbyte_loop_e:
NOP;
-failed:
+.Lfailed:
R0=0;
RTS;
-found:
+.Lfound:
R0 = P0;
R0 += -1;
RTS;
diff --git a/libc/string/bfin/memcmp.S b/libc/string/bfin/memcmp.S
index 117550cdb..b5d4f1c7a 100644
--- a/libc/string/bfin/memcmp.S
+++ b/libc/string/bfin/memcmp.S
@@ -1,5 +1,5 @@
/* memcmp.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* int memcmp(const void *s1, const void *s2, size_t n);
* R0 = First Address (s1)
* R1 = Second Address (s2)
@@ -17,34 +19,30 @@
* Favours word aligned data.
*/
-#include <features.h>
-
.text
.align 2
-.global _memcmp
-.type _memcmp, STT_FUNC
-_memcmp:
+ENTRY(_memcmp)
I1 = P3;
- P0 = R0; // P0 = s1 address
- P3 = R1; // P3 = s2 Address
- P2 = R2 ; // P2 = count
+ P0 = R0; /* P0 = s1 address */
+ P3 = R1; /* P3 = s2 Address */
+ P2 = R2 ; /* P2 = count */
CC = R2 <= 7(IU);
- IF CC JUMP too_small;
- I0 = R1; // s2
- R1 = R1 | R0; // OR addresses together
- R1 <<= 30; // check bottom two bits
- CC = AZ; // AZ set if zero.
- IF !CC JUMP bytes ; // Jump if addrs not aligned.
+ IF CC JUMP .Ltoo_small;
+ I0 = R1; /* s2 */
+ R1 = R1 | R0; /* OR addresses together */
+ R1 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes ; /* Jump if addrs not aligned. */
- P1 = P2 >> 2; // count = n/4
+ P1 = P2 >> 2; /* count = n/4 */
R3 = 3;
- R2 = R2 & R3; // remainder
- P2 = R2; // set remainder
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
- LSETUP (quad_loop_s , quad_loop_e) LC0=P1;
-quad_loop_s:
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s:
#if !defined(__WORKAROUND_AVOID_DAG1)
MNOP || R0 = [P0++] || R1 = [I0++];
#else
@@ -52,48 +50,50 @@ quad_loop_s:
R1 = [I0++];
#endif
CC = R0 == R1;
- IF !CC JUMP quad_different;
-quad_loop_e:
+ IF !CC JUMP .Lquad_different;
+.Lquad_loop_e:
NOP;
- P3 = I0; // s2
-too_small:
- CC = P2 == 0; //Check zero count
- IF CC JUMP finished; // very unlikely
+ P3 = I0; /* s2 */
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely*/
-bytes:
- LSETUP (byte_loop_s , byte_loop_e) LC0=P2;
-byte_loop_s:
- R1 = B[P3++](Z); // *s2
- R0 = B[P0++](Z); // *s1
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s:
+ R1 = B[P3++](Z); /* *s2 */
+ R0 = B[P0++](Z); /* *s1 */
CC = R0 == R1;
- IF !CC JUMP different;
-byte_loop_e:
+ IF !CC JUMP .Ldifferent;
+.Lbyte_loop_e:
NOP;
-different:
+.Ldifferent:
R0 = R0 - R1;
P3 = I1;
RTS;
-quad_different:
- // We've read two quads which don't match.
- // Can't just compare them, because we're
- // a little-endian machine, so the MSBs of
- // the regs occur at later addresses in the
- // string.
- // Arrange to re-read those two quads again,
- // byte-by-byte.
- P0 += -4; // back up to the start of the
- P3 = I0; // quads, and increase the
- P2 += 4; // remainder count
+.Lquad_different:
+ /* We've read two quads which don't match.
+ * Can't just compare them, because we're
+ * a little-endian machine, so the MSBs of
+ * the regs occur at later addresses in the
+ * string.
+ * Arrange to re-read those two quads again,
+ * byte-by-byte.
+ */
+ P0 += -4; /* back up to the start of the */
+ P3 = I0; /* quads, and increase the*/
+ P2 += 4; /* remainder count*/
P3 += -4;
- JUMP bytes;
+ JUMP .Lbytes;
-finished:
+.Lfinished:
R0 = 0;
P3 = I1;
RTS;
+
.size _memcmp,.-_memcmp
libc_hidden_def (memcmp)
diff --git a/libc/string/bfin/memcpy.S b/libc/string/bfin/memcpy.S
index e7ba7048e..ae40cb244 100644
--- a/libc/string/bfin/memcpy.S
+++ b/libc/string/bfin/memcpy.S
@@ -1,5 +1,5 @@
/* memcpy.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* void *memcpy(void *dest, const void *src, size_t n);
* R0 = To Address (dest) (leave unchanged to form result)
* R1 = From Address (src)
@@ -21,54 +23,60 @@
.align 2
-.global _memcpy
-.type _memcpy, STT_FUNC
-_memcpy:
+/* We have to bypass the libc-symbols.h machinery to make sure we get
+ * a weak symbol for memcpy (some crummy gcc tests want to redefine it).
+ */
+.global ___GI_memcpy
+.type ___GI_memcpy, STT_FUNC
+___GI_memcpy:
[--SP] = P3;
- P0 = R0; // P0 = To address
- P3 = R1; // P3 = From Address
- P2 = R2 ; // P2 = count
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
CC = R2 <= 7(IU);
- IF CC JUMP too_small;
+ IF CC JUMP .Ltoo_small;
I0 = R1;
- R3 = R1 | R0; // OR addresses together
- R3 <<= 30; // check bottom two bits
- CC = AZ; // AZ set if zero.
- IF !CC JUMP bytes ; // Jump if addrs not aligned.
- P1 = P2 >> 2; // count = n/4
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned. */
+ P1 = P2 >> 2; /* count = n/4 */
P1 += -1;
R3 = 3;
- R2 = R2 & R3; // remainder
- P2 = R2; // set remainder
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
R1 = [I0++];
#if !defined(__WORKAROUND_AVOID_DAG1)
- LSETUP (quad_loop , quad_loop) LC0=P1;
-quad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
#else
- LSETUP (quad_loop_s , quad_loop_e) LC0=P1;
-quad_loop_s: [P0++] = R1;
-quad_loop_e: R1 = [I0++];
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
#endif
[P0++] = R1;
- CC = P2 == 0; // any remaining bytes?
- P3 = I0; // Ammend P3 for remaining copy
- IF !CC JUMP bytes;
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 for remaining copy */
+ IF !CC JUMP .Lbytes;
P3 = [SP++];
RTS;
-too_small:
- CC = P2 == 0; //Check zero count
- IF CC JUMP finished; // very unlikely
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* very unlikely */
-bytes:
- LSETUP (byte_loop_s , byte_loop_e) LC0=P2;
-byte_loop_s: R1 = B[P3++](Z);
-byte_loop_e: B[P0++] = R1;
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s: R1 = B[P3++](Z);
+.Lbyte_loop_e: B[P0++] = R1;
-finished:
+.Lfinished:
P3 = [SP++];
+
RTS;
-.size _memcpy,.-_memcpy
+.size ___GI_memcpy,.-___GI_memcpy
-libc_hidden_def (memcpy)
+.hidden ___GI_memcpy
+.weak _memcpy
+.set _memcpy,___GI_memcpy
diff --git a/libc/string/bfin/memmove.S b/libc/string/bfin/memmove.S
index 3d446f326..da1128387 100644
--- a/libc/string/bfin/memmove.S
+++ b/libc/string/bfin/memmove.S
@@ -1,5 +1,5 @@
/* memmove.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* void *memmove(void *dest, const void *src, size_t n);
* R0 = To Address (dest) (leave unchanged to form result)
* R1 = From Address (src)
@@ -21,75 +23,84 @@
.align 2
-.global _memmove
-.type _memmove, STT_FUNC
-_memmove:
+ /* We have to bypass the libc-symbols.h machinery to make sure we get
+ a weak symbol for memcpy (some crummy gcc tests want to redefine
+ it). */
+.global ___GI_memmove
+.type ___GI_memmove, STT_FUNC
+___GI_memmove:
I1 = P3;
- P0 = R0; // P0 = To address
- P3 = R1; // P3 = From Address
- P2 = R2 ; // P2 = count
- CC = P2 == 0; //Check zero count
- IF CC JUMP finished; // very unlikely
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely */
- CC = R1 < R0 (IU); // From < To
- IF !CC JUMP no_overlap;
+ CC = R1 < R0 (IU); /* From < To */
+ IF !CC JUMP .Lno_overlap;
R3 = R1 + R2;
- CC = R0 <= R3 (IU); // (From+len) >= To
- IF CC JUMP overlap;
-no_overlap:
+ CC = R0 <= R3 (IU); /* (From+len) >= To */
+ IF CC JUMP .Loverlap;
+.Lno_overlap:
R3 = 11;
CC = R2 <= R3;
- IF CC JUMP bytes;
- R3 = R1 | R0; // OR addresses together
- R3 <<= 30; // check bottom two bits
- CC = AZ; // AZ set if zero.
- IF !CC JUMP bytes ; // Jump if addrs not aligned.
+ IF CC JUMP .Lbytes;
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero.*/
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned.*/
I0 = P3;
- P1 = P2 >> 2; // count = n/4
+ P1 = P2 >> 2; /* count = n/4 */
P1 += -1;
R3 = 3;
- R2 = R2 & R3; // remainder
- P2 = R2; // set remainder
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
R1 = [I0++];
#if !defined(__WORKAROUND_AVOID_DAG1)
- LSETUP (quad_loop , quad_loop) LC0=P1;
-quad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
#else
- LSETUP (quad_loop_s, quad_loop_e) LC0=P1;
-quad_loop_s: [P0++] = R1;
-quad_loop_e: R1 = [I0++];
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
#endif
[P0++] = R1;
- CC = P2 == 0; // any remaining bytes?
- P3 = I0; // Ammend P3 to updated ptr.
- IF !CC JUMP bytes;
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 to updated ptr. */
+ IF !CC JUMP .Lbytes;
P3 = I1;
RTS;
-bytes: LSETUP (byte2_s , byte2_e) LC0=P2;
-byte2_s: R1 = B[P3++](Z);
-byte2_e: B[P0++] = R1;
+.Lbytes: LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
+.Lbyte2_s: R1 = B[P3++](Z);
+.Lbyte2_e: B[P0++] = R1;
-finished:
- P3 = I1;
+.Lfinished: P3 = I1;
RTS;
-overlap:
+.Loverlap:
P2 += -1;
P0 = P0 + P2;
P3 = P3 + P2;
R1 = B[P3--] (Z);
CC = P2 == 0;
- IF CC JUMP no_loop;
- LSETUP (ol_s, ol_e) LC0 = P2;
-ol_s: B[P0--] = R1;
-ol_e: R1 = B[P3--] (Z);
-no_loop: B[P0] = R1;
+ IF CC JUMP .Lno_loop;
+#if defined(__WORKAROUND_SPECULATIVE_LOADS)
+ NOP;
+ NOP;
+#endif
+ LSETUP (.Lol_s, .Lol_e) LC0 = P2;
+.Lol_s: B[P0--] = R1;
+.Lol_e: R1 = B[P3--] (Z);
+.Lno_loop: B[P0] = R1;
P3 = I1;
RTS;
-.size _memmove,.-_memmove
-libc_hidden_def (memmove)
+.size ___GI_memmove,.-___GI_memmove
+
+.hidden ___GI_memmove
+.weak _memmove
+.set _memmove,___GI_memmove
diff --git a/libc/string/bfin/memset.S b/libc/string/bfin/memset.S
index bd8eb4b6a..c8ee0835f 100644
--- a/libc/string/bfin/memset.S
+++ b/libc/string/bfin/memset.S
@@ -1,5 +1,5 @@
/* memset.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* void *memset(void *s, int c, size_t n);
* R0 = address (s) (leave unchanged to form result)
* R1 = filler byte (c)
@@ -21,66 +23,74 @@
.align 2
-.global _memset
-.type _memset, STT_FUNC
-_memset:
- P0 = R0 ; // P0 = address
- P2 = R2 ; // P2 = count
- R3 = R0 + R2; // end
+/* We have to bypass the libc-symbols.h machinery to make sure we get
+ * a weak symbol for memcpy (some crummy gcc tests want to redefine it).
+ */
+.global ___GI_memset
+.type ___GI_memset, STT_FUNC
+___GI_memset:
+ P0 = R0 ; /* P0 = address */
+ P2 = R2 ; /* P2 = count */
+ R3 = R0 + R2; /* end */
CC = R2 <= 7(IU);
- IF CC JUMP too_small;
- R1 = R1.B (Z); // R1 = fill char
+ IF CC JUMP .Ltoo_small;
+ R1 = R1.B (Z); /* R1 = fill char */
R2 = 3;
- R2 = R0 & R2; // addr bottom two bits
- CC = R2 == 0; // AZ set if zero.
- IF !CC JUMP force_align ; // Jump if addr not aligned.
+ R2 = R0 & R2; /* addr bottom two bits */
+ CC = R2 == 0; /* AZ set if zero. */
+ IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
-aligned:
- P1 = P2 >> 2; // count = n/4
- R2 = R1 << 8; // create quad filler
+.Laligned:
+ P1 = P2 >> 2; /* count = n/4 */
+ R2 = R1 << 8; /* create quad filler */
R2.L = R2.L + R1.L(NS);
R2.H = R2.L + R1.H(NS);
P2 = R3;
- LSETUP (quad_loop , quad_loop) LC0=P1;
-quad_loop:
+ LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
+.Lquad_loop:
[P0++] = R2;
CC = P0 == P2;
- IF !CC JUMP bytes_left;
+ IF !CC JUMP .Lbytes_left;
RTS;
-bytes_left:
- R2 = R3; // end point
- R3 = P0; // current position
- R2 = R2 - R3; // bytes left
+.Lbytes_left:
+ R2 = R3; /* end point */
+ R3 = P0; /* current position */
+ R2 = R2 - R3; /* bytes left */
P2 = R2;
-too_small:
- CC = P2 == 0; //Check zero count
- IF CC JUMP finished; // Unusual
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* Unusual */
-bytes: LSETUP (byte_loop , byte_loop) LC0=P2;
-byte_loop: B[P0++] = R1;
+.Lbytes:
+ LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
+.Lbyte_loop:
+ B[P0++] = R1;
-finished:
+.Lfinished:
RTS;
-force_align:
- CC = BITTST (R0, 0 ); // odd byte
+.Lforce_align:
+ CC = BITTST (R0, 0); /* odd byte */
R0 = 4;
R0 = R0 - R2;
P1 = R0;
- R0 = P0; // Recover return address
- IF !CC JUMP skip1;
+ R0 = P0; /* Recover return address */
+ IF !CC JUMP .Lskip1;
B[P0++] = R1;
-skip1:
- CC = R2 <= 2; // 2 bytes
- P2 -= P1; // reduce count
- IF !CC JUMP aligned;
+.Lskip1:
+ CC = R2 <= 2; /* 2 bytes */
+ P2 -= P1; /* reduce count */
+ IF !CC JUMP .Laligned;
B[P0++] = R1;
B[P0++] = R1;
- JUMP aligned;
-.size _memset,.-_memset
+ JUMP .Laligned;
+
+.size ___GI_memset,.-___GI_memset
-libc_hidden_def (memset)
+.hidden ___GI_memset
+.weak _memset
+.set _memset,___GI_memset
diff --git a/libc/string/bfin/strcmp.S b/libc/string/bfin/strcmp.S
index 07629c03b..c0a706d2b 100644
--- a/libc/string/bfin/strcmp.S
+++ b/libc/string/bfin/strcmp.S
@@ -1,5 +1,5 @@
/* strcmp.S
- * Copyright (C) 2003, 2005, 2006 Analog Devices Inc., All Rights Reserved.
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
*
* This file is subject to the terms and conditions of the GNU Library General
* Public License. See the file "COPYING.LIB" in the main directory of this
@@ -9,6 +9,8 @@
* http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
*/
+#include <sysdep.h>
+
/* Fast strcmp() for Blackfin.
* When both strings are aligned, this processes four characters at
* a time. Uses a hw loop with "very big" count to loop "forever",
@@ -17,15 +19,11 @@
* loop to check more carefully (same as the unaligned case).
*/
-#include <features.h>
-
.text
.align 2
-.global _strcmp
-.type _strcmp, STT_FUNC
-_strcmp:
+ENTRY(_strcmp)
[--sp] = (R7:4);
p1 = r0;
p2 = r1;
@@ -36,13 +34,13 @@ _strcmp:
r0 = r0 | r1; // check both pointers at same time
r0 <<= 30; // dump all but last 2 bits
cc = az; // are they zero?
- if !cc jump unaligned; // no; use unaligned code.
+ if !cc jump .Lunaligned; // no; use unaligned code.
// fall-thru for aligned case..
// note that r0 is zero from the previous...
// p0 set to -1
- lsetup (beginloop, endloop) lc0=p0;
+ LSETUP (.Lbeginloop, .Lendloop) lc0=p0;
// pick up first words
r1 = [p1++];
r2 = [p2++];
@@ -51,8 +49,8 @@ _strcmp:
r7.h = 0xFF;
// loop : 9 cycles to check 4 characters
cc = r1 == r2;
-beginloop:
- if !cc jump notequal4; // compare failure, exit loop
+.Lbeginloop:
+ if !cc jump .Lnotequal4; // compare failure, exit loop
// starting with 44332211
// see if char 3 or char 1 is 0
@@ -65,18 +63,18 @@ beginloop:
// add to zero, and (r1 is free, reload)
r6 = r3 +|+ r0 || r1 = [p1++] || nop;
cc |= az; // true if either is zero
- if cc jump zero4; // leave if a zero somewhere
-endloop:
+ if cc jump .Lzero4; // leave if a zero somewhere
+.Lendloop:
cc = r1 == r2;
// loop exits
-notequal4: // compare failure on 4-char compare
+.Lnotequal4: // compare failure on 4-char compare
// address pointers are one word ahead;
// faster to use zero4 exit code
p1 += 4;
p2 += 4;
-zero4: // one of the bytes in word 1 is zero
+.Lzero4: // one of the bytes in word 1 is zero
// but we've already fetched the next word; so
// backup two to look at failing word again
p1 += -8;
@@ -87,27 +85,27 @@ zero4: // one of the bytes in word 1 is zero
// here when pointers are unaligned: checks one
// character at a time. Also use at the end of
// the word-check algorithm to figure out what happened
-unaligned:
+.Lunaligned:
// R0 is non-zero from before.
// p0 set to -1
r0 = 0 (Z);
r1 = B[p1++] (Z);
r2 = B[p2++] (Z);
- lsetup (beginloop1, endloop1) lc0=p0;
+ LSETUP (.Lbeginloop1, .Lendloop1) lc0=p0;
-beginloop1:
+.Lbeginloop1:
cc = r1; // first char must be non-zero
// chars must be the same
r3 = r2 - r1 (NS) || r1 = B[p1++] (Z) || nop;
cc &= az;
r3 = r0 - r2; // second char must be non-zero
cc &= an;
- if !cc jump exitloop1;
-endloop1:
+ if !cc jump .Lexitloop1;
+.Lendloop1:
r2 = B[p2++] (Z);
-exitloop1: // here means we found a zero or a difference.
+.Lexitloop1: // here means we found a zero or a difference.
// we have r2(N), p2(N), r1(N+1), p1(N+2)
r1=B[p1+ -2] (Z);
r0 = r1 - r2;