Linux Audio

Check our new training course

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