Imported Upstream version 6.0.0
[platform/upstream/gmp.git] / mpn / vax / addmul_1.asm
1 dnl  VAX mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
2 dnl  to a second limb vector.
3
4 dnl  Copyright 1992, 1994, 1996, 2000, 2012 Free Software Foundation, Inc.
5
6 dnl  This file is part of the GNU MP Library.
7 dnl
8 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl  it under the terms of either:
10 dnl
11 dnl    * the GNU Lesser General Public License as published by the Free
12 dnl      Software Foundation; either version 3 of the License, or (at your
13 dnl      option) any later version.
14 dnl
15 dnl  or
16 dnl
17 dnl    * the GNU General Public License as published by the Free Software
18 dnl      Foundation; either version 2 of the License, or (at your option) any
19 dnl      later version.
20 dnl
21 dnl  or both in parallel, as here.
22 dnl
23 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26 dnl  for more details.
27 dnl
28 dnl  You should have received copies of the GNU General Public License and the
29 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30 dnl  see https://www.gnu.org/licenses/.
31
32 include(`../config.m4')
33
34 ASM_START()
35 PROLOGUE(mpn_addmul_1)
36         .word   0xfc0
37         movl    12(ap), r4
38         movl    8(ap), r8
39         movl    4(ap), r9
40         clrl    r3
41         incl    r4
42         ashl    $-1, r4, r7
43         clrl    r11
44         movl    16(ap), r6
45         jlss    L(v0_big)
46         jlbc    r4, L(1)
47
48 C Loop for v0 < 0x80000000
49 L(tp1): movl    (r8)+, r1
50         jlss    L(1n0)
51         emul    r1, r6, $0, r2
52         addl2   r11, r2
53         adwc    $0, r3
54         addl2   r2, (r9)+
55         adwc    $0, r3
56 L(1):   movl    (r8)+, r1
57         jlss    L(1n1)
58 L(1p1): emul    r1, r6, $0, r10
59         addl2   r3, r10
60         adwc    $0, r11
61         addl2   r10, (r9)+
62         adwc    $0, r11
63
64         sobgtr  r7, L(tp1)
65         movl    r11, r0
66         ret
67
68 L(1n0): emul    r1, r6, $0, r2
69         addl2   r11, r2
70         adwc    r6, r3
71         addl2   r2, (r9)+
72         adwc    $0, r3
73         movl    (r8)+, r1
74         jgeq    L(1p1)
75 L(1n1): emul    r1, r6, $0, r10
76         addl2   r3, r10
77         adwc    r6, r11
78         addl2   r10, (r9)+
79         adwc    $0, r11
80
81         sobgtr  r7, L(tp1)
82         movl    r11, r0
83         ret
84
85 L(v0_big):
86         jlbc    r4, L(2)
87
88 C Loop for v0 >= 0x80000000
89 L(tp2): movl    (r8)+, r1
90         jlss    L(2n0)
91         emul    r1, r6, $0, r2
92         addl2   r11, r2
93         adwc    r1, r3
94         addl2   r2, (r9)+
95         adwc    $0, r3
96 L(2):   movl    (r8)+, r1
97         jlss    L(2n1)
98 L(2p1): emul    r1, r6, $0, r10
99         addl2   r3, r10
100         adwc    r1, r11
101         addl2   r10, (r9)+
102         adwc    $0, r11
103
104         sobgtr  r7, L(tp2)
105         movl    r11, r0
106         ret
107
108 L(2n0): emul    r1, r6, $0, r2
109         addl2   r11, r2
110         adwc    r6, r3
111         addl2   r2, (r9)+
112         adwc    r1, r3
113         movl    (r8)+, r1
114         jgeq    L(2p1)
115 L(2n1): emul    r1, r6, $0, r10
116         addl2   r3, r10
117         adwc    r6, r11
118         addl2   r10, (r9)+
119         adwc    r1, r11
120
121         sobgtr  r7, L(tp2)
122         movl    r11, r0
123         ret
124 EPILOGUE()