1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 3 /* 3 /* 4 * memcmp for PowerPC32 4 * memcmp for PowerPC32 5 * 5 * 6 * Copyright (C) 1996 Paul Mackerras. 6 * Copyright (C) 1996 Paul Mackerras. 7 * 7 * 8 */ 8 */ 9 9 10 #include <linux/export.h> 10 #include <linux/export.h> 11 #include <asm/ppc_asm.h> 11 #include <asm/ppc_asm.h> 12 12 13 .text 13 .text 14 14 15 _GLOBAL(memcmp) 15 _GLOBAL(memcmp) 16 srawi. r7, r5, 2 /* Div 16 srawi. r7, r5, 2 /* Divide len by 4 */ 17 mr r6, r3 17 mr r6, r3 18 beq- 3f 18 beq- 3f 19 mtctr r7 19 mtctr r7 20 li r7, 0 20 li r7, 0 21 1: lwzx r3, r6, r7 21 1: lwzx r3, r6, r7 22 lwzx r0, r4, r7 22 lwzx r0, r4, r7 23 addi r7, r7, 4 23 addi r7, r7, 4 24 cmplw cr0, r3, r0 24 cmplw cr0, r3, r0 25 bdnzt eq, 1b 25 bdnzt eq, 1b 26 bne 5f 26 bne 5f 27 3: andi. r3, r5, 3 27 3: andi. r3, r5, 3 28 beqlr 28 beqlr 29 cmplwi cr1, r3, 2 29 cmplwi cr1, r3, 2 30 blt- cr1, 4f 30 blt- cr1, 4f 31 lhzx r3, r6, r7 31 lhzx r3, r6, r7 32 lhzx r0, r4, r7 32 lhzx r0, r4, r7 33 addi r7, r7, 2 33 addi r7, r7, 2 34 subf. r3, r0, r3 34 subf. r3, r0, r3 35 beqlr cr1 35 beqlr cr1 36 bnelr 36 bnelr 37 4: lbzx r3, r6, r7 37 4: lbzx r3, r6, r7 38 lbzx r0, r4, r7 38 lbzx r0, r4, r7 39 subf. r3, r0, r3 39 subf. r3, r0, r3 40 blr 40 blr 41 5: li r3, 1 41 5: li r3, 1 42 bgtlr 42 bgtlr 43 li r3, -1 43 li r3, -1 44 blr 44 blr 45 EXPORT_SYMBOL(memcmp) 45 EXPORT_SYMBOL(memcmp)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.