Blame sysdeps/s390/s390-32/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.
Packit 6c4009
   Copyright (C) 2000-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 MP Library is free software; you can redistribute it and/or modify
Packit 6c4009
   it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
   the Free Software Foundation; either version 2.1 of the License, or (at your
Packit 6c4009
   option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU MP Library is distributed in the hope that it will be useful, but
Packit 6c4009
   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 6c4009
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
Packit 6c4009
   License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
   along with the GNU MP Library; see the file COPYING.LIB.  If not,
Packit 6c4009
   see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
  INPUT PARAMETERS
Packit 6c4009
  res_ptr	%r2
Packit 6c4009
  s1_ptr	%r3
Packit 6c4009
  s2_ptr	%r4
Packit 6c4009
  size		%r5
Packit 6c4009
*/
Packit 6c4009
Packit 6c4009
#include "sysdep.h"
Packit 6c4009
#include "asm-syntax.h"
Packit 6c4009
Packit 6c4009
ENTRY(__mpn_sub_n)
Packit 6c4009
	st     %r6,24(%r15)   # save register 6
Packit 6c4009
	cfi_offset (%r6, -72)
Packit 6c4009
	sr     %r1,%r1
Packit 6c4009
	lhi    %r0,1          # cannot use ahi to add carry, use slr
Packit 6c4009
.L0:    l      %r6,0(%r1,%r3) # .L0 -> no carry from last sub
Packit 6c4009
	sl     %r6,0(%r1,%r4)
Packit 6c4009
	st     %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,4(0,%r1)
Packit 6c4009
	brc    4,.L3
Packit 6c4009
.L1:    brct   %r5,.L0
Packit 6c4009
	slr    %r2,%r2        # no last carry to return
Packit 6c4009
	j      .Lexit
Packit 6c4009
.L2:    l      %r6,0(%r1,%r3) # .L2 -> carry from last sub
Packit 6c4009
	sl     %r6,0(%r1,%r4)
Packit 6c4009
	brc    4,.L4
Packit 6c4009
	slr    %r6,%r0        # no carry yet, add carry from last sub
Packit 6c4009
	st     %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,4(0,%r1)
Packit 6c4009
	brc    11,.L1         # new carry ?
Packit 6c4009
.L3:    brct   %r5,.L2
Packit 6c4009
	lr     %r2,%r0        # return last carry
Packit 6c4009
	j      .Lexit
Packit 6c4009
.L4:    slr    %r6,%r0        # already a carry, add carry from last sub
Packit 6c4009
	st     %r6,0(%r1,%r2)
Packit 6c4009
	la     %r1,4(0,%r1)
Packit 6c4009
	brct   %r5,.L2
Packit 6c4009
	lr     %r2,%r0        # return last carry
Packit 6c4009
.Lexit: l      %r6,24(%r15)   # restore register 6
Packit 6c4009
	br     %r14
Packit 6c4009
END(__mpn_sub_n)