Blame sysdeps/sparc/sparc64/memcmp.S

Packit Service 82fcde
/* Compare two memory blocks for differences in the first COUNT bytes.
Packit Service 82fcde
   For SPARC v9.
Packit Service 82fcde
   Copyright (C) 1998-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
   Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
Packit Service 82fcde
                  Jakub Jelinek <jj@ultra.linux.cz>.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
#include <asm/asi.h>
Packit Service 82fcde
#ifndef XCC
Packit Service 82fcde
#define XCC xcc
Packit Service 82fcde
#define USE_BPR
Packit Service 82fcde
	.register	%g2, #scratch
Packit Service 82fcde
	.register	%g3, #scratch
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
	.text
Packit Service 82fcde
	.align		32
Packit Service 82fcde
ENTRY(memcmp)
Packit Service 82fcde
#ifdef USE_BPR
Packit Service 82fcde
	brz,pn		%o2, 3f				/* CTI+IEU1	Group		*/
Packit Service 82fcde
#else
Packit Service 82fcde
	tst		%o2				/* IEU1		Group		*/
Packit Service 82fcde
	be,pn		%XCC, 3f			/* CTI				*/
Packit Service 82fcde
#endif
Packit Service 82fcde
	 andcc		%o0, 7, %g0			/* IEU1		Group		*/
Packit Service 82fcde
	bne,pn		%icc, 8f			/* CTI				*/
Packit Service 82fcde
1:	 andcc		%o1, 7, %g1			/* IEU1		Group		*/
Packit Service 82fcde
Packit Service 82fcde
	bne,pn		%icc, 10f			/* CTI				*/
Packit Service 82fcde
	 mov		64, %g3				/* IEU0				*/
Packit Service 82fcde
	ldx		[%o0], %g1			/* Load		Group		*/
Packit Service 82fcde
	sub		%o1, %o0, %o1			/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
	ldx		[%o0 + %o1], %g2		/* Load		Group		*/
Packit Service 82fcde
	add		%o0, 8, %o0			/* IEU0				*/
Packit Service 82fcde
2:	mov		%g1, %o3			/* IEU0		Group		*/
Packit Service 82fcde
	subcc		%o2, 8, %o2			/* IEU1				*/
Packit Service 82fcde
Packit Service 82fcde
	bcs,pn		%XCC, 5f			/* CTI				*/
Packit Service 82fcde
	 ldxa		[%o0] ASI_PNF, %g1		/* Load		Group		*/
Packit Service 82fcde
	mov		%g2, %o4			/* IEU0				*/
Packit Service 82fcde
	ldxa		[%o0 + %o1] ASI_PNF, %g2	/* Load		Group		*/
Packit Service 82fcde
Packit Service 82fcde
	cmp		%o3, %o4			/* IEU1				*/
Packit Service 82fcde
	be,pt		%xcc, 2b			/* CTI				*/
Packit Service 82fcde
	 add		%o0, 8, %o0			/* IEU0				*/
Packit Service 82fcde
7:	mov		-1, %o0				/* IEU1				*/
Packit Service 82fcde
Packit Service 82fcde
	retl						/* CTI+IEU1	Group		*/
Packit Service 82fcde
	 movgu		%xcc, 1, %o0			/* Single	Group		*/
Packit Service 82fcde
3:	retl						/* CTI+IEU1	Group		*/
Packit Service 82fcde
	 clr		%o0				/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
	.align		16
Packit Service 82fcde
5:	mov		%g2, %o4			/* IEU0				*/
Packit Service 82fcde
6:	cmp		%o2, -8				/* IEU1				*/
Packit Service 82fcde
	be,pn		%XCC, 3b			/* CTI				*/
Packit Service 82fcde
	 sub		%g0, %o2, %o2			/* IEU0		Group		*/
Packit Service 82fcde
Packit Service 82fcde
	sllx		%o2, 3, %o2			/* IEU0		Group		*/
Packit Service 82fcde
	srlx		%o3, %o2, %o3			/* IEU0		Group		*/
Packit Service 82fcde
	srlx		%o4, %o2, %o4			/* IEU0		Group		*/
Packit Service 82fcde
	clr		%o0				/* IEU1				*/
Packit Service 82fcde
Packit Service 82fcde
	cmp		%o3, %o4			/* IEU1		Group		*/
Packit Service 82fcde
	movgu		%xcc, 1, %o0			/* Single	Group		*/
Packit Service 82fcde
	retl						/* CTI+IEU1	Group		*/
Packit Service 82fcde
	 movlu		%xcc, -1, %o0			/* Single	Group		*/
Packit Service 82fcde
Packit Service 82fcde
8:	ldub		[%o0], %o3			/* Load				*/
Packit Service 82fcde
	add		%o0, 1, %o0			/* IEU0				*/
Packit Service 82fcde
	ldub		[%o1], %o4			/* Load		Group		*/
Packit Service 82fcde
	add		%o1, 1, %o1			/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
9:	cmp		%o3, %o4			/* IEU1		Group		*/
Packit Service 82fcde
	bne,pn		%xcc, 12f			/* CTI				*/
Packit Service 82fcde
	 subcc		%o2, 1, %o2			/* IEU1		Group		*/
Packit Service 82fcde
	be,pn		%XCC, 3b			/* CTI				*/
Packit Service 82fcde
Packit Service 82fcde
	 lduba		[%o0] ASI_PNF, %o3		/* Load				*/
Packit Service 82fcde
	andcc		%o0, 7, %g0			/* IEU1		Group		*/
Packit Service 82fcde
	be,pn		%icc, 1b			/* CTI				*/
Packit Service 82fcde
	 lduba		[%o1] ASI_PNF, %o4		/* Load				*/
Packit Service 82fcde
Packit Service 82fcde
	add		%o0, 1, %o0			/* IEU0		Group		*/
Packit Service 82fcde
	ba,pt		%xcc, 9b			/* CTI				*/
Packit Service 82fcde
	 add		%o1, 1, %o1			/* IEU1				*/
Packit Service 82fcde
Packit Service 82fcde
	.align		16
Packit Service 82fcde
12:	mov		-1, %o0				/* IEU0		Group		*/
Packit Service 82fcde
	cmp		%o3, %o4			/* IEU1				*/
Packit Service 82fcde
	retl						/* CTI+IEU1	Group		*/
Packit Service 82fcde
	 movgu		%xcc, 1, %o0			/* Single	Group		*/
Packit Service 82fcde
Packit Service 82fcde
	.align		16
Packit Service 82fcde
	nop						/* Stub				*/
Packit Service 82fcde
10:	sllx		%g1, 3, %g2			/* IEU0		Group		*/
Packit Service 82fcde
	sub		%o1, %g1, %o1			/* IEU1				*/
Packit Service 82fcde
	sub		%g3, %g2, %g3			/* IEU0		Group		*/
Packit Service 82fcde
Packit Service 82fcde
	ldxa		[%o0] ASI_PNF, %g5		/* Load				*/
Packit Service 82fcde
	sub		%o1, %o0, %o1			/* IEU1				*/
Packit Service 82fcde
	ldxa		[%o0 + %o1] ASI_PNF, %g4	/* Load		Group		*/
Packit Service 82fcde
	add		%o0, 8, %o0			/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
11:	sllx		%g4, %g2, %o4			/* IEU0		Group		*/
Packit Service 82fcde
	ldxa		[%o0 + %o1] ASI_PNF, %g4	/* Load				*/
Packit Service 82fcde
	srlx		%g4, %g3, %o5			/* IEU0		Group		*/
Packit Service 82fcde
	mov		%g5, %o3			/* IEU1				*/
Packit Service 82fcde
Packit Service 82fcde
	ldxa		[%o0] ASI_PNF, %g5		/* Load				*/
Packit Service 82fcde
	subcc		%o2, 8, %o2			/* IEU1		Group		*/
Packit Service 82fcde
	bcs,pn		%XCC, 6b			/* CTI				*/
Packit Service 82fcde
	 or		%o4, %o5, %o4			/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
	cmp		%o3, %o4			/* IEU1		Group		*/
Packit Service 82fcde
	be,pt		%xcc, 11b			/* CTI				*/
Packit Service 82fcde
	 add		%o0, 8, %o0			/* IEU0				*/
Packit Service 82fcde
	mov		-1, %o0				/* IEU0				*/
Packit Service 82fcde
Packit Service 82fcde
	retl						/* CTI+IEU1	Group		*/
Packit Service 82fcde
	 movgu		%xcc, 1, %o0			/* Single	Group		*/
Packit Service 82fcde
END(memcmp)
Packit Service 82fcde
Packit Service 82fcde
#undef bcmp
Packit Service 82fcde
weak_alias (memcmp, bcmp)
Packit Service 82fcde
libc_hidden_builtin_def (memcmp)