Blame sysdeps/s390/s390-64/sub_n.S

Packit 6c4009
/* __mpn_sub_n -- Add two limb vectors of the same length > 0 and store
Packit 6c4009
   sum in a third limb vector.  64 bit S/390 version.
Packit 6c4009
   Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 6c4009
   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
Packit 6c4009
   This file is part of the GNU MP Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public License as
Packit 6c4009
   published by the Free Software Foundation; either version 2.1 of the
Packit 6c4009
   License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
Packit 6c4009
   see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/* INPUT PARAMETERS
Packit 6c4009
     %r2 = res_ptr
Packit 6c4009
     %r3 = s1_ptr
Packit 6c4009
     %r4 = s2_ptr
Packit 6c4009
     %r5 = size.  */
Packit 6c4009
Packit 6c4009
#include "sysdep.h"
Packit 6c4009
#include "asm-syntax.h"
Packit 6c4009
Packit 6c4009
ENTRY(__mpn_sub_n)
Packit 6c4009
        stg    %r6,48(%r15)   # save register 6
Packit 6c4009
	cfi_offset (%r6,-112)
Packit 6c4009
        sgr    %r1,%r1
Packit 6c4009
        lghi   %r0,1          # cannot use ahi to add carry, use slr
Packit 6c4009
.L0:	lg     %r6,0(%r1,%r3) # .L0 -> no carry from last sub
Packit 6c4009
	slg    %r6,0(%r1,%r4)
Packit 6c4009
	stg    %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,8(%r1)
Packit 6c4009
	brc    4,.L3
Packit 6c4009
.L1:	brct   %r5,.L0
Packit 6c4009
	slgr   %r2,%r2	      # no last carry to return
Packit 6c4009
	j      .Lexit
Packit 6c4009
.L2:	lg     %r6,0(%r1,%r3) # .L2 -> carry from last sub
Packit 6c4009
	slg    %r6,0(%r1,%r4)
Packit 6c4009
	brc    4,.L4
Packit 6c4009
	slgr   %r6,%r0	      # no carry yet, add carry from last sub
Packit 6c4009
	stg    %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,8(%r1)
Packit 6c4009
	brc    11,.L1	      # new carry ?
Packit 6c4009
.L3:	brct   %r5,.L2
Packit 6c4009
	lgr    %r2,%r0	      # return last carry
Packit 6c4009
	j      .Lexit
Packit 6c4009
.L4:	slgr   %r6,%r0	      # already a carry, add carry from last sub
Packit 6c4009
	stg    %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,8(%r1)
Packit 6c4009
	brct   %r5,.L2
Packit 6c4009
	lgr    %r2,%r0	      # return last carry
Packit 6c4009
.Lexit: lg     %r6,48(%r15)   # restore register 6
Packit 6c4009
	br     %r14
Packit 6c4009
END(__mpn_sub_n)