Blame sysdeps/sparc/sparc64/sub_n.S

Packit Service 82fcde
/* SPARC v9 __mpn_sub_n -- Subtract two limb vectors of the same length > 0
Packit Service 82fcde
   and store difference in a third limb vector.
Packit Service 82fcde
Packit Service 82fcde
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit Service 82fcde
Packit Service 82fcde
   This file is part of the GNU MP Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU MP Library is free software; you can redistribute it and/or modify
Packit Service 82fcde
   it under the terms of the GNU Lesser General Public License as published by
Packit Service 82fcde
   the Free Software Foundation; either version 2.1 of the License, or (at your
Packit Service 82fcde
   option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU MP Library is distributed in the hope that it will be useful, but
Packit Service 82fcde
   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit Service 82fcde
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
Packit Service 82fcde
   License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public License
Packit Service 82fcde
   along with the GNU MP Library; see the file COPYING.LIB.  If not,
Packit Service 82fcde
   see <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
Packit Service 82fcde
/* INPUT PARAMETERS
Packit Service 82fcde
   res_ptr	%o0
Packit Service 82fcde
   s1_ptr	%o1
Packit Service 82fcde
   s2_ptr	%o2
Packit Service 82fcde
   size		%o3  */
Packit Service 82fcde
Packit Service 82fcde
ENTRY(__mpn_sub_n)
Packit Service 82fcde
Packit Service 82fcde
	sub %g0,%o3,%g5
Packit Service 82fcde
	sllx %o3,3,%g1
Packit Service 82fcde
	add %o1,%g1,%o1			! make s1_ptr point at end
Packit Service 82fcde
	add %o2,%g1,%o2			! make s2_ptr point at end
Packit Service 82fcde
	add %o0,%g1,%o0			! make res_ptr point at end
Packit Service 82fcde
	mov 0,%o4			! clear carry variable
Packit Service 82fcde
	sllx %g5,3,%o5			! compute initial address index
Packit Service 82fcde
Packit Service 82fcde
1:	ldx [%o2+%o5],%g1		! load s2 limb
Packit Service 82fcde
	add %g5,1,%g5			! increment loop count
Packit Service 82fcde
	ldx [%o1+%o5],%o3		! load s1 limb
Packit Service 82fcde
	addcc %g1,%o4,%g1		! add s2 limb and carry variable
Packit Service 82fcde
	movcc %xcc,0,%o4		! if carry-out, o4 was 1; clear it
Packit Service 82fcde
	subcc %o3,%g1,%g1		! subtract s1 limb from sum
Packit Service 82fcde
	stx %g1,[%o0+%o5]		! store result
Packit Service 82fcde
	add %o5,8,%o5			! increment address index
Packit Service 82fcde
	brnz,pt %g5,1b
Packit Service 82fcde
	 movcs %xcc,1,%o4		! if s1 subtract gave carry, record it
Packit Service 82fcde
Packit Service 82fcde
	retl
Packit Service 82fcde
	 mov %o4,%o0
Packit Service 82fcde
Packit Service 82fcde
END(__mpn_sub_n)