Upload Tizen:Base source
[external/gmp.git] / mpn / s390 / mul_1.asm
1 dnl  S/390 mpn_mul_1 -- Multiply a limb vector with a limb and store the
2 dnl  result in 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_mul_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         lr      cylimb,0        # new cylimb
47         st      1,0(rp)         # store
48         la      up,4(,up)
49         la      rp,4(,rp)
50         brct    n,.Loopn
51
52         lr      2,cylimb
53         lm      6,7,24(15)
54         br      14
55
56 .Loopp: l       1,0(up)         # load from u
57         lr      6,1             #
58         mr      0,vlimb         # multiply signed
59         sra     6,31            # make mask
60         nr      6,vlimb         # 0 or vlimb
61         alr     0,6             # conditionally add vlimb to phi
62         alr     1,cylimb        # add carry limb to plo
63         brc     8+4,+8          # branch if not carry
64         ahi     0,1             # increment phi
65         lr      cylimb,0        # new cylimb
66         st      1,0(rp)         # store
67         la      up,4(,up)
68         la      rp,4(,rp)
69         brct    n,.Loopp
70
71         lr      2,cylimb
72         lm      6,7,24(15)
73         br      14
74 EPILOGUE(mpn_mul_1)