1/* S390 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2   the result to a second limb vector.
3   Copyright (C) 2000-2022 Free Software Foundation, Inc.
4   This file is part of the GNU MP Library.
5
6   The GNU MP Library is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or (at your
9   option) any later version.
10
11   The GNU MP Library is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public License
17   along with the GNU MP Library; see the file COPYING.LIB.  If not,
18   see <https://www.gnu.org/licenses/>.  */
19
20/*
21   INPUT PARAMETERS
22   res_ptr	%r2
23   s1_ptr	%r3
24   sizeP	%r4
25   s2_limb	%r5
26*/
27
28#include "sysdep.h"
29#include "asm-syntax.h"
30
31	.text
32ENTRY(__mpn_addmul_1)
33	st     %r6,24(%r15)
34	cfi_offset (%r6, -72)
35	slr    %r6,%r6            # cy_limb = 0
36.L0:	icm    %r1,15,0(%r3)      # get s1_ptr[i]
37	mr     %r0,%r5            # umul_ppmm(prod_high,prod_low,s1_ptr[j],s2_limb)
38	jnm    .L1
39	alr    %r0,%r5
40.L1:	ltr    %r5,%r5
41	jnm    .L2
42	al     %r0,0(%r3)
43.L2:	alr    %r1,%r6            # prod_low += cy_limb
44	lr     %r6,%r0            # cy_limb = prod_high
45	brc    12,.L3
46	ahi    %r6,1              #           + (prod_low < cy_limb)
47.L3:	al     %r1,0(%r2)         # prod_low += res_ptr[i]
48	brc    12,.L4
49	ahi    %r6,1              # cy_limb++
50.L4:	st     %r1,0(%r2)
51	la     %r2,4(0,%r2)
52	la     %r3,4(0,%r3)
53	brct   %r4,.L0
54        lr     %r2,%r6            # return cy_limb
55	l      %r6,24(%r15)
56.Lexit:	br     %r14
57END(__mpn_addmul_1)
58