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

TOMOYO Linux Cross Reference
Linux/arch/arc/lib/strcmp-archs.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 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
  4  */
  5 
  6 #include <linux/linkage.h>
  7 
  8 ENTRY_CFI(strcmp)
  9         or      r2, r0, r1
 10         bmsk_s  r2, r2, 1
 11         brne    r2, 0, @.Lcharloop
 12 
 13 ;;; s1 and s2 are word aligned
 14         ld.ab   r2, [r0, 4]
 15 
 16         mov_s   r12, 0x01010101
 17         ror     r11, r12
 18         .align  4
 19 .LwordLoop:
 20         ld.ab   r3, [r1, 4]
 21         ;; Detect NULL char in str1
 22         sub     r4, r2, r12
 23         ld.ab   r5, [r0, 4]
 24         bic     r4, r4, r2
 25         and     r4, r4, r11
 26         brne.d.nt       r4, 0, .LfoundNULL
 27         ;; Check if the read locations are the same
 28         cmp     r2, r3
 29         beq.d   .LwordLoop
 30         mov.eq  r2, r5
 31 
 32         ;; A match is found, spot it out
 33 #ifdef __LITTLE_ENDIAN__
 34         swape   r3, r3
 35         mov_s   r0, 1
 36         swape   r2, r2
 37 #else
 38         mov_s   r0, 1
 39 #endif
 40         cmp_s   r2, r3
 41         j_s.d   [blink]
 42         bset.lo r0, r0, 31
 43 
 44         .align 4
 45 .LfoundNULL:
 46 #ifdef __BIG_ENDIAN__
 47         swape   r4, r4
 48         swape   r2, r2
 49         swape   r3, r3
 50 #endif
 51         ;; Find null byte
 52         ffs     r0, r4
 53         bmsk    r2, r2, r0
 54         bmsk    r3, r3, r0
 55         swape   r2, r2
 56         swape   r3, r3
 57         ;; make the return value
 58         sub.f   r0, r2, r3
 59         mov.hi  r0, 1
 60         j_s.d   [blink]
 61         bset.lo r0, r0, 31
 62 
 63         .align 4
 64 .Lcharloop:
 65         ldb.ab  r2, [r0, 1]
 66         ldb.ab  r3, [r1, 1]
 67         nop
 68         breq    r2, 0, .Lcmpend
 69         breq    r2, r3, .Lcharloop
 70 
 71         .align 4
 72 .Lcmpend:
 73         j_s.d   [blink]
 74         sub     r0, r2, r3
 75 END_CFI(strcmp)

~ [ 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