~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/lib/memcmp.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm64/lib/memcmp.S (Version linux-6.12-rc7) and /arch/sparc/lib/memcmp.S (Version linux-6.10.14)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    !!   1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                             !!   2 /* Sparc optimized memcmp code.
  3  * Copyright (c) 2013-2021, Arm Limited.       << 
  4  *                                                  3  *
  5  * Adapted from the original at:               !!   4  * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6  * https://github.com/ARM-software/optimized-r !!   5  * Copyright (C) 2000, 2008 David S. Miller (davem@davemloft.net)
  7  */                                                 6  */
  8                                                     7 
                                                   >>   8 #include <linux/export.h>
  9 #include <linux/linkage.h>                          9 #include <linux/linkage.h>
 10 #include <asm/assembler.h>                     !!  10 #include <asm/asm.h>
 11                                                    11 
 12 /* Assumptions:                                !!  12         .text
 13  *                                             !!  13 ENTRY(memcmp)
 14  * ARMv8-a, AArch64, unaligned accesses.       !!  14         cmp     %o2, 0
 15  */                                            !!  15 1:      BRANCH32(be, pn, 2f)
 16                                                !!  16          nop
 17 #define L(label) .L ## label                   !!  17         ldub    [%o0], %g7
 18                                                !!  18         ldub    [%o1], %g3
 19 /* Parameters and result.  */                  !!  19         sub     %o2, 1, %o2
 20 #define src1            x0                     !!  20         add     %o0, 1, %o0
 21 #define src2            x1                     !!  21         add     %o1, 1, %o1
 22 #define limit           x2                     !!  22         subcc   %g7, %g3, %g3
 23 #define result          w0                     !!  23         BRANCH32(be, pt, 1b)
 24                                                !!  24          cmp    %o2, 0
 25 /* Internal variables.  */                     !!  25         retl
 26 #define data1           x3                     !!  26          mov    %g3, %o0
 27 #define data1w          w3                     !!  27 2:      retl
 28 #define data1h          x4                     !!  28          mov    0, %o0
 29 #define data2           x5                     !!  29 ENDPROC(memcmp)
 30 #define data2w          w5                     !!  30 EXPORT_SYMBOL(memcmp)
 31 #define data2h          x6                     << 
 32 #define tmp1            x7                     << 
 33 #define tmp2            x8                     << 
 34                                                << 
 35 SYM_FUNC_START(__pi_memcmp)                    << 
 36         subs    limit, limit, 8                << 
 37         b.lo    L(less8)                       << 
 38                                                << 
 39         ldr     data1, [src1], 8               << 
 40         ldr     data2, [src2], 8               << 
 41         cmp     data1, data2                   << 
 42         b.ne    L(return)                      << 
 43                                                << 
 44         subs    limit, limit, 8                << 
 45         b.gt    L(more16)                      << 
 46                                                << 
 47         ldr     data1, [src1, limit]           << 
 48         ldr     data2, [src2, limit]           << 
 49         b       L(return)                      << 
 50                                                << 
 51 L(more16):                                     << 
 52         ldr     data1, [src1], 8               << 
 53         ldr     data2, [src2], 8               << 
 54         cmp     data1, data2                   << 
 55         bne     L(return)                      << 
 56                                                << 
 57         /* Jump directly to comparing the last << 
 58            strings.  */                        << 
 59         subs    limit, limit, 16               << 
 60         b.ls    L(last_bytes)                  << 
 61                                                << 
 62         /* We overlap loads between 0-32 bytes << 
 63            try to align, so limit it only to s << 
 64         cmp     limit, 96                      << 
 65         b.ls    L(loop16)                      << 
 66                                                << 
 67         /* Align src1 and adjust src2 with byt << 
 68         and     tmp1, src1, 15                 << 
 69         add     limit, limit, tmp1             << 
 70         sub     src1, src1, tmp1               << 
 71         sub     src2, src2, tmp1               << 
 72                                                << 
 73         /* Loop performing 16 bytes per iterat << 
 74            Limit is pre-decremented by 16 and  << 
 75            Exit if <= 16 bytes left to do or i << 
 76         .p2align 4                             << 
 77 L(loop16):                                     << 
 78         ldp     data1, data1h, [src1], 16      << 
 79         ldp     data2, data2h, [src2], 16      << 
 80         subs    limit, limit, 16               << 
 81         ccmp    data1, data2, 0, hi            << 
 82         ccmp    data1h, data2h, 0, eq          << 
 83         b.eq    L(loop16)                      << 
 84                                                << 
 85         cmp     data1, data2                   << 
 86         bne     L(return)                      << 
 87         mov     data1, data1h                  << 
 88         mov     data2, data2h                  << 
 89         cmp     data1, data2                   << 
 90         bne     L(return)                      << 
 91                                                << 
 92         /* Compare last 1-16 bytes using unali << 
 93 L(last_bytes):                                 << 
 94         add     src1, src1, limit              << 
 95         add     src2, src2, limit              << 
 96         ldp     data1, data1h, [src1]          << 
 97         ldp     data2, data2h, [src2]          << 
 98         cmp     data1, data2                   << 
 99         bne     L(return)                      << 
100         mov     data1, data1h                  << 
101         mov     data2, data2h                  << 
102         cmp     data1, data2                   << 
103                                                << 
104         /* Compare data bytes and set return v << 
105 L(return):                                     << 
106 #ifndef __AARCH64EB__                          << 
107         rev     data1, data1                   << 
108         rev     data2, data2                   << 
109 #endif                                         << 
110         cmp     data1, data2                   << 
111 L(ret_eq):                                     << 
112         cset    result, ne                     << 
113         cneg    result, result, lo             << 
114         ret                                    << 
115                                                << 
116         .p2align 4                             << 
117         /* Compare up to 8 bytes.  Limit is [- << 
118 L(less8):                                      << 
119         adds    limit, limit, 4                << 
120         b.lo    L(less4)                       << 
121         ldr     data1w, [src1], 4              << 
122         ldr     data2w, [src2], 4              << 
123         cmp     data1w, data2w                 << 
124         b.ne    L(return)                      << 
125         sub     limit, limit, 4                << 
126 L(less4):                                      << 
127         adds    limit, limit, 4                << 
128         beq     L(ret_eq)                      << 
129 L(byte_loop):                                  << 
130         ldrb    data1w, [src1], 1              << 
131         ldrb    data2w, [src2], 1              << 
132         subs    limit, limit, 1                << 
133         ccmp    data1w, data2w, 0, ne   /* NZC << 
134         b.eq    L(byte_loop)                   << 
135         sub     result, data1w, data2w         << 
136         ret                                    << 
137 SYM_FUNC_END(__pi_memcmp)                      << 
138 SYM_FUNC_ALIAS_WEAK(memcmp, __pi_memcmp)       << 
139 EXPORT_SYMBOL_NOKASAN(memcmp)                  << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php