mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-10-30 10:45:40 +03:00 
			
		
		
		
	* sysdeps/powerpc/fpu/s_copysign.S: Use L() instead of local labels. * sysdeps/powerpc/submul_1.S: Likewise. * sysdeps/powerpc/sub_n.S: Likewise. * sysdeps/powerpc/strcpy.S: Likewise. * sysdeps/powerpc/strcmp.S: Likewise. * sysdeps/powerpc/stpcpy.S: Likewise. * sysdeps/powerpc/rshift.S: Likewise. * sysdeps/powerpc/mul_1.S: Likewise. * sysdeps/powerpc/memset.S: Likewise. * sysdeps/powerpc/lshift.S: Likewise. * sysdeps/powerpc/addmul_1.S: Likewise. * sysdeps/powerpc/add_n.S: Likewise.
		
			
				
	
	
		
			116 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
			
		
		
	
	
			116 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
| /* Optimized strcmp implementation for PowerPC.
 | |
|    Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
 | |
|    This file is part of the GNU C Library.
 | |
| 
 | |
|    The GNU C Library is free software; you can redistribute it and/or
 | |
|    modify it under the terms of the GNU Library General Public License as
 | |
|    published by the Free Software Foundation; either version 2 of the
 | |
|    License, or (at your option) any later version.
 | |
| 
 | |
|    The GNU C Library is distributed in the hope that it will be useful,
 | |
|    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | |
|    Library General Public License for more details.
 | |
| 
 | |
|    You should have received a copy of the GNU Library General Public
 | |
|    License along with the GNU C Library; see the file COPYING.LIB.  If not,
 | |
|    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 | |
|    Boston, MA 02111-1307, USA.  */
 | |
| 
 | |
| #include <sysdep.h>
 | |
| 
 | |
| /* See strlen.s for comments on how the end-of-string testing works.  */
 | |
| 
 | |
| EALIGN(strcmp,4,0)
 | |
| /* int [r3] strcmp (const char *p1 [r3], const char *p2 [r4])  */
 | |
| 
 | |
| /* General register assignments:
 | |
|    r0:	temporary
 | |
|    r3:	pointer to previous word in s1
 | |
|    r4:	pointer to previous word in s2
 | |
|    r5:	current word from s1
 | |
|    r6:	current word from s2
 | |
|    r7:	0xfefefeff
 | |
|    r8:	0x7f7f7f7f
 | |
|    r9:	~(word in s1 | 0x7f7f7f7f)  */
 | |
| 
 | |
| /* Register assignments in the prologue:
 | |
|    r10:	low 2 bits of p2-p1
 | |
|    r11:	mask to orc with r5/r6  */
 | |
| 
 | |
| 	or    r0,r4,r3
 | |
| 	clrlwi. r0,r0,30
 | |
| 	lis   r7,0xfeff
 | |
| 	bne   L(unaligned)
 | |
| 
 | |
| 	lwz   r5,0(r3)
 | |
| 	lwz   r6,0(r4)
 | |
| 	lis   r8,0x7f7f
 | |
| 	addi  r7,r7,-0x101
 | |
| 	addi  r8,r8,0x7f7f
 | |
| 	b     L(g1)
 | |
| 
 | |
| L(g0):	lwzu  r5,4(r3)
 | |
| 	bne   cr1,L(different)
 | |
| 	lwzu  r6,4(r4)
 | |
| L(g1):	add   r0,r7,r5
 | |
| 	nor   r9,r8,r5
 | |
| 	and.  r0,r0,r9
 | |
| 	cmpw  cr1,r5,r6
 | |
| 	beq+  L(g0)
 | |
| L(endstring):
 | |
| /* OK. We've hit the end of the string. We need to be careful that
 | |
|    we don't compare two strings as different because of gunk beyond
 | |
|    the end of the strings...  */
 | |
| 	and   r0,r8,r5
 | |
| 	beq   cr1,L(equal)
 | |
| 	add   r0,r0,r8
 | |
| 	xor.  r10,r5,r6
 | |
| 	andc  r9,r9,r0
 | |
| 	blt-  L(highbit)
 | |
| 	cntlzw r10,r10
 | |
| 	cntlzw r9,r9
 | |
| 	addi  r9,r9,7
 | |
| 	cmpw  cr1,r9,r10
 | |
| 	sub   r3,r5,r6
 | |
| 	bgelr+ cr1
 | |
| L(equal):
 | |
| 	li    r3,0
 | |
| 	blr
 | |
| 
 | |
| L(different):
 | |
| 	lwz   r5,-4(r3)
 | |
| 	xor.  r10,r5,r6
 | |
| 	sub   r3,r5,r6
 | |
| 	bgelr+
 | |
| L(highbit):
 | |
| 	ori   r3,r6,1
 | |
| 	blr
 | |
| 
 | |
| 
 | |
| /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
 | |
| 	.align 4
 | |
| L(unaligned):
 | |
| 	lbz   r5,0(r3)
 | |
| 	lbz   r6,0(r4)
 | |
| 	b     L(u1)
 | |
| 
 | |
| L(u0):	lbzu  r5,1(r3)
 | |
| 	bne-  L(u4)
 | |
| 	lbzu  r6,1(r4)
 | |
| L(u1):	cmpwi cr1,r5,0
 | |
| 	beq-  cr1,L(u3)
 | |
| 	cmpw  r5,r6
 | |
| 	bne-  L(u3)
 | |
| 	lbzu  r5,1(r3)
 | |
| 	lbzu  r6,1(r4)
 | |
| 	cmpwi cr1,r5,0
 | |
| 	cmpw  r5,r6
 | |
| 	bne+  cr1,L(u0)
 | |
| L(u3):	sub   r3,r5,r6
 | |
| 	blr
 | |
| L(u4):	lbz   r5,-1(r3)
 | |
| 	sub   r3,r5,r6
 | |
| 	blr
 | |
| END(strcmp)
 |