File: memcmp_32.S

package info (click to toggle)
linux 6.1.139-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,495,880 kB
  • sloc: ansic: 23,469,452; asm: 266,614; sh: 110,522; makefile: 49,887; python: 36,990; perl: 36,834; cpp: 6,056; yacc: 4,908; lex: 2,725; awk: 1,440; ruby: 25; sed: 5
file content (45 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* SPDX-License-Identifier: GPL-2.0 */

/*
 * memcmp for PowerPC32
 *
 * Copyright (C) 1996 Paul Mackerras.
 *
 */

#include <asm/ppc_asm.h>
#include <asm/export.h>

	.text

_GLOBAL(memcmp)
	srawi.	r7, r5, 2		/* Divide len by 4 */
	mr	r6, r3
	beq-	3f
	mtctr	r7
	li	r7, 0
1:	lwzx	r3, r6, r7
	lwzx	r0, r4, r7
	addi	r7, r7, 4
	cmplw	cr0, r3, r0
	bdnzt	eq, 1b
	bne	5f
3:	andi.	r3, r5, 3
	beqlr
	cmplwi	cr1, r3, 2
	blt-	cr1, 4f
	lhzx	r3, r6, r7
	lhzx	r0, r4, r7
	addi	r7, r7, 2
	subf.	r3, r0, r3
	beqlr	cr1
	bnelr
4:	lbzx	r3, r6, r7
	lbzx	r0, r4, r7
	subf.	r3, r0, r3
	blr
5:	li	r3, 1
	bgtlr
	li	r3, -1
	blr
EXPORT_SYMBOL(memcmp)