Upload Tizen:Base source
[external/gmp.git] / mpn / s390 / addmul_1.asm
1 dnl  S/390 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
2 dnl  result to a second limb vector.
3
4 dnl  Copyright 2001 Free Software Foundation, Inc.
5
6 dnl  This file is part of the GNU MP Library.
7
8 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl  it under the terms of the GNU Lesser General Public License as published
10 dnl  by the Free Software Foundation; either version 3 of the License, or (at
11 dnl  your option) any later version.
12
13 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 dnl  License for more details.
17
18 dnl  You should have received a copy of the GNU Lesser General Public License
19 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21 include(`../config.m4')
22
23 define(`rp',2)
24 define(`up',3)
25 define(`n',4)
26 define(`vlimb',5)
27 define(`cylimb',7)
28
29 ASM_START()
30 PROLOGUE(mpn_addmul_1)
31         stm     6,7,24(15)
32         slr     cylimb,cylimb   # clear cylimb
33         ltr     vlimb,vlimb
34         jnl     .Loopp
35
36 .Loopn: l       1,0(up)         # load from u
37         lr      6,1             #
38         mr      0,vlimb         # multiply signed
39         alr     0,6             # add vlimb to phi
40         sra     6,31            # make mask
41         nr      6,vlimb         # 0 or vlimb
42         alr     0,6             # conditionally add vlimb to phi
43         alr     1,cylimb        # add carry limb to plo
44         brc     8+4,+8          # branch if not carry
45         ahi     0,1             # increment phi
46         l       6,0(rp)         # load r limb
47         alr     6,1             # add u limb to plo
48         brc     8+4,+8          # branch if not carry
49         ahi     0,1             # increment phi
50         lr      cylimb,0        # new cylimb
51         st      6,0(rp)         # store
52         la      up,4(,up)
53         la      rp,4(,rp)
54         brct    n,.Loopn
55
56         lr      2,cylimb
57         lm      6,7,24(15)
58         br      14
59
60 .Loopp: l       1,0(up)         # load from u
61         lr      6,1             #
62         mr      0,vlimb         # multiply signed
63         sra     6,31            # make mask
64         nr      6,vlimb         # 0 or vlimb
65         alr     0,6             # conditionally add vlimb to phi
66         alr     1,cylimb        # add carry limb to plo
67         brc     8+4,+8          # branch if not carry
68         ahi     0,1             # increment phi
69         l       6,0(rp)         # load r limb
70         alr     6,1             # add u limb to plo
71         brc     8+4,+8          # branch if not carry
72         ahi     0,1             # increment phi
73         lr      cylimb,0        # new cylimb
74         st      6,0(rp)         # store
75         la      up,4(,up)
76         la      rp,4(,rp)
77         brct    n,.Loopp
78
79         lr      2,cylimb
80         lm      6,7,24(15)
81         br      14
82 EPILOGUE(mpn_addmul_1)