Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/arch/arm/string Use unsigned comparisons for...



details:   https://anonhg.NetBSD.org/src/rev/9b47a51c8245
branches:  trunk
changeset: 373125:9b47a51c8245
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Jan 19 18:03:03 2023 +0000

description:
Use unsigned comparisons for pointers and size_t values.

diffstat:

 common/lib/libc/arch/arm/string/memcpy_arm.S    |   76 +++++-----
 common/lib/libc/arch/arm/string/memcpy_neon.S   |   42 +++---
 common/lib/libc/arch/arm/string/memcpy_xscale.S |   78 ++++++------
 common/lib/libc/arch/arm/string/memmove.S       |  156 ++++++++++++------------
 common/lib/libc/arch/arm/string/memset.S        |  120 +++++++++---------
 common/lib/libc/arch/arm/string/memset_naive.S  |   12 +-
 common/lib/libc/arch/arm/string/strlen_neon.S   |   10 +-
 7 files changed, 247 insertions(+), 247 deletions(-)

diffs (truncated from 1258 to 300 lines):

diff -r ce370a6ce565 -r 9b47a51c8245 common/lib/libc/arch/arm/string/memcpy_arm.S
--- a/common/lib/libc/arch/arm/string/memcpy_arm.S      Thu Jan 19 17:07:38 2023 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy_arm.S      Thu Jan 19 18:03:03 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memcpy_arm.S,v 1.5 2013/12/02 21:21:33 joerg Exp $     */
+/*     $NetBSD: memcpy_arm.S,v 1.6 2023/01/19 18:03:03 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
        push    {r0, lr}                /* memcpy() returns dest addr */
 
        subs    r2, r2, #4
-       blt     .Lmemcpy_l4             /* less than 4 bytes */
+       blo     .Lmemcpy_l4             /* less than 4 bytes */
        ands    r12, r0, #3
        bne     .Lmemcpy_destul         /* oh unaligned destination addr */
        ands    r12, r1, #3
@@ -75,9 +75,9 @@
 .Lmemcpy_t8:
        /* We have aligned source and destination */
        subs    r2, r2, #8
-       blt     .Lmemcpy_l12            /* less than 12 bytes (4 from above) */
+       blo     .Lmemcpy_l12            /* less than 12 bytes (4 from above) */
        subs    r2, r2, #0x14
-       blt     .Lmemcpy_l32            /* less than 32 bytes (12 from above) */
+       blo     .Lmemcpy_l32            /* less than 32 bytes (12 from above) */
        push    {r4}            /* borrow r4 */
 
        /* blat 32 bytes at a time */
@@ -88,12 +88,12 @@
        ldmia   r1!, {r3, r4, r12, lr}
        stmia   r0!, {r3, r4, r12, lr}
        subs    r2, r2, #0x20
-       bge     .Lmemcpy_loop32
+       bhs     .Lmemcpy_loop32
 
        cmn     r2, #0x10
-       ldmiage r1!, {r3, r4, r12, lr}  /* blat a remaining 16 bytes */
-       stmiage r0!, {r3, r4, r12, lr}
-       subge   r2, r2, #0x10
+       ldmiahs r1!, {r3, r4, r12, lr}  /* blat a remaining 16 bytes */
+       stmiahs r0!, {r3, r4, r12, lr}
+       subhs   r2, r2, #0x10
        pop     {r4}            /* return r4 */
 
 .Lmemcpy_l32:
@@ -101,21 +101,21 @@
 
        /* blat 12 bytes at a time */
 .Lmemcpy_loop12:
-       ldmiage r1!, {r3, r12, lr}
-       stmiage r0!, {r3, r12, lr}
-       subsge  r2, r2, #0x0c
-       bge     .Lmemcpy_loop12
+       ldmiahs r1!, {r3, r12, lr}
+       stmiahs r0!, {r3, r12, lr}
+       subshs  r2, r2, #0x0c
+       bhs     .Lmemcpy_loop12
 
 .Lmemcpy_l12:
        adds    r2, r2, #8
-       blt     .Lmemcpy_l4
+       blo     .Lmemcpy_l4
 
        subs    r2, r2, #4
        ldrlt   r3, [r1], #4
        strlt   r3, [r0], #4
-       ldmiage r1!, {r3, r12}
-       stmiage r0!, {r3, r12}
-       subge   r2, r2, #4
+       ldmiahs r1!, {r3, r12}
+       stmiahs r0!, {r3, r12}
+       subhs   r2, r2, #4
 
 .Lmemcpy_l4:
        /* less than 4 bytes to go */
@@ -129,10 +129,10 @@
        cmp     r2, #2
        ldrb    r3, [r1], #1
        strb    r3, [r0], #1
-       ldrbge  r3, [r1], #1
-       strbge  r3, [r0], #1
-       ldrbgt  r3, [r1], #1
-       strbgt  r3, [r0], #1
+       ldrbhs  r3, [r1], #1
+       strbhs  r3, [r0], #1
+       ldrbhi  r3, [r1], #1
+       strbhi  r3, [r0], #1
        pop     {r0, pc}
 
        /* erg - unaligned destination */
@@ -143,12 +143,12 @@
        /* align destination with byte copies */
        ldrb    r3, [r1], #1
        strb    r3, [r0], #1
-       ldrbge  r3, [r1], #1
-       strbge  r3, [r0], #1
-       ldrbgt  r3, [r1], #1
-       strbgt  r3, [r0], #1
+       ldrbhs  r3, [r1], #1
+       strbhs  r3, [r0], #1
+       ldrbhi  r3, [r1], #1
+       strbhi  r3, [r0], #1
        subs    r2, r2, r12
-       blt     .Lmemcpy_l4             /* less the 4 bytes */
+       blo     .Lmemcpy_l4             /* less the 4 bytes */
 
        ands    r12, r1, #3
        beq     .Lmemcpy_t8             /* we have an aligned source */
@@ -159,10 +159,10 @@
        bic     r1, r1, #3
        ldr     lr, [r1], #4
        cmp     r12, #2
-       bgt     .Lmemcpy_srcul3
+       bhi     .Lmemcpy_srcul3
        beq     .Lmemcpy_srcul2
        cmp     r2, #0x0c
-       blt     .Lmemcpy_srcul1loop4
+       blo     .Lmemcpy_srcul1loop4
        sub     r2, r2, #0x0c
        push    {r4, r5}
 
@@ -192,10 +192,10 @@
 #endif
        stmia   r0!, {r3-r5, r12}
        subs    r2, r2, #0x10
-       bge     .Lmemcpy_srcul1loop16
+       bhs     .Lmemcpy_srcul1loop16
        pop     {r4, r5}
        adds    r2, r2, #0x0c
-       blt     .Lmemcpy_srcul1l4
+       blo     .Lmemcpy_srcul1l4
 
 .Lmemcpy_srcul1loop4:
 #ifdef __ARMEB__
@@ -211,7 +211,7 @@
 #endif
        str     r12, [r0], #4
        subs    r2, r2, #4
-       bge     .Lmemcpy_srcul1loop4
+       bhs     .Lmemcpy_srcul1loop4
 
 .Lmemcpy_srcul1l4:
        sub     r1, r1, #3
@@ -219,7 +219,7 @@
 
 .Lmemcpy_srcul2:
        cmp     r2, #0x0c
-       blt     .Lmemcpy_srcul2loop4
+       blo     .Lmemcpy_srcul2loop4
        sub     r2, r2, #0x0c
        push    {r4, r5}
 
@@ -249,10 +249,10 @@
 #endif
        stmia   r0!, {r3-r5, r12}
        subs    r2, r2, #0x10
-       bge     .Lmemcpy_srcul2loop16
+       bhs     .Lmemcpy_srcul2loop16
        pop     {r4, r5}
        adds    r2, r2, #0x0c
-       blt     .Lmemcpy_srcul2l4
+       blo     .Lmemcpy_srcul2l4
 
 .Lmemcpy_srcul2loop4:
 #ifdef __ARMEB__
@@ -268,7 +268,7 @@
 #endif
        str     r12, [r0], #4
        subs    r2, r2, #4
-       bge     .Lmemcpy_srcul2loop4
+       bhs     .Lmemcpy_srcul2loop4
 
 .Lmemcpy_srcul2l4:
        sub     r1, r1, #2
@@ -276,7 +276,7 @@
 
 .Lmemcpy_srcul3:
        cmp     r2, #0x0c
-       blt     .Lmemcpy_srcul3loop4
+       blo     .Lmemcpy_srcul3loop4
        sub     r2, r2, #0x0c
        push    {r4, r5}
 
@@ -306,10 +306,10 @@
 #endif
        stmia   r0!, {r3-r5, r12}
        subs    r2, r2, #0x10
-       bge     .Lmemcpy_srcul3loop16
+       bhs     .Lmemcpy_srcul3loop16
        pop     {r4, r5}
        adds    r2, r2, #0x0c
-       blt     .Lmemcpy_srcul3l4
+       blo     .Lmemcpy_srcul3l4
 
 .Lmemcpy_srcul3loop4:
 #ifdef __ARMEB__
@@ -325,7 +325,7 @@
 #endif
        str     r12, [r0], #4
        subs    r2, r2, #4
-       bge     .Lmemcpy_srcul3loop4
+       bhs     .Lmemcpy_srcul3loop4
 
 .Lmemcpy_srcul3l4:
        sub     r1, r1, #1
diff -r ce370a6ce565 -r 9b47a51c8245 common/lib/libc/arch/arm/string/memcpy_neon.S
--- a/common/lib/libc/arch/arm/string/memcpy_neon.S     Thu Jan 19 17:07:38 2023 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy_neon.S     Thu Jan 19 18:03:03 2023 +0000
@@ -29,7 +29,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: memcpy_neon.S,v 1.1 2013/01/03 09:34:44 matt Exp $")
+RCSID("$NetBSD: memcpy_neon.S,v 1.2 2023/01/19 18:03:03 mlelstv Exp $")
 
        .text
 ENTRY(memcpy)
@@ -40,7 +40,7 @@
        mov     r3, r0                  /* keep r0 unchanged */
 #if 0
        cmp     r2, #16                 /* copy less than 8 bytes? */
-       bge     .Ldst_aligner           /*   nope, do it the long way */
+       bhs     .Ldst_aligner           /*   nope, do it the long way */
 
 1:     ldrb    ip, [r1], #1            /* load a byte from src */
        subs    r2, r2, #1              /* and more to transfer? */
@@ -78,7 +78,7 @@
        vld1.64 {d1}, [r1:64]!          /* load a dword from src */
 
        cmp     r2, r5                  /* do we already have enough? */
-       bgt     .Lincongruent           /*   no, so read more */
+       bhi     .Lincongruent           /*   no, so read more */
 
 .Lincongruent_finish:
        vtbl.8  d0, {d1-d2}, d0         /* merge last dwords */
@@ -86,14 +86,14 @@
 #ifdef __ARMEB__
        vrev64.32 d0, d0                /* word swap to LE */
 #endif
-       blt     .Lfinish                /*   no, write final partial dword */
+       blo     .Lfinish                /*   no, write final partial dword */
        vst1.32 {d0}, [r3:64]           /*   yes, write final full dword */
        b       .Ldone                  /* and we're done! */
 
 .Lincongruent:
        vld1.64 {d2}, [r1:64]!          /* load a dword */
        cmp     r2, #8                  /* can we write a full dword? */
-       blt     .Lincongruent_finish    /*   no, finish it. */
+       blo     .Lincongruent_finish    /*   no, finish it. */
        vtbl.8  d1, {d1-d2}, d0         /* reorder */
        vst1.64 {d1}, [r3:64]!          /* store a dword */
        subs    r2, r2, #8              /* have we written everything? */
@@ -109,10 +109,10 @@
         * last byte).
         */
        cmp     r2, #32                 /* can we write 4 more dwords? */
-       blt     .Lincongruent_dword     /*   no, handle dword by dword */
+       blo     .Lincongruent_dword     /*   no, handle dword by dword */
        vld1.64 {d2-d5}, [r1:64]!       /* read 4 dwords */
        cmp     r2, #64                 /* can we write 4 more dwords? */
-       blt     .Lincongruent_4dword    /*   no, handle it */
+       blo     .Lincongruent_4dword    /*   no, handle it */
 
 1:     vld1.64 {d7-d10}, [r1:64]!      /* read 4 dwords */
        vtbl.8  d1, {d1-d2}, d0         /* reorder */
@@ -122,7 +122,7 @@
        vst1.64 {d1-d4}, [r3:64]!       /* write 4 dwords */
        vmov    d6, d5                  /* move out of the way the load */
        cmp     r2, #96                 /* have 8+4 dwords to write? */
-       blt     2f                      /*   no more data, skip the load */
+       blo     2f                      /*   no more data, skip the load */
        vld1.64 {d2-d5}, [r1:64]!       /* more data, load 4 dwords */
 2:     vtbl.8  d6, {d6-d7}, d0         /* reorder */
        vtbl.8  d7, {d7-d8}, d0         /* reorder */
@@ -133,14 +133,14 @@
        beq     .Ldone
        vmov    d1, d10
        cmp     r2, #64
-       bge     1b
+       bhs     1b
 
        /*
         * we have leftovers in d1 and new untranslated date in d2-d5.
         */
 .Lincongruent_4dword:
        cmp     r2, #32
-       blt     .Lincongruent_dword
+       blo     .Lincongruent_dword
 
        vtbl.8  d1, {d1-d2}, d0         /* reorder */
        vtbl.8  d2, {d2-d3}, d0         /* reorder */
@@ -154,10 +154,10 @@
 .Lincongruent_dword:
 #if 0
        cmp     r2, r5                  /* enough in leftovers? */
-       ble     .Lincongruent_finish    /*   yes, finish it. */
+       bls     .Lincongruent_finish    /*   yes, finish it. */
        vld1.64 {d2}, [r1:64]!          /* load a dword */



Home | Main Index | Thread Index | Old Index