Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / vax / addmul_1.s
1 # VAX __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
2 # the result to a second limb vector.
3
4 # Copyright (C) 1992, 1994, 1996, 2000 Free Software Foundation, Inc.
5
6 # This file is part of the GNU MP Library.
7
8 # The GNU MP Library is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2.1 of the License, or (at your
11 # option) any later version.
12
13 # The GNU MP Library is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 # License for more details.
17
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
20 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 # MA 02111-1307, USA.
22
23
24 # INPUT PARAMETERS
25 # res_ptr       (sp + 4)
26 # s1_ptr        (sp + 8)
27 # size          (sp + 12)
28 # s2_limb       (sp + 16)
29
30 .text
31         .align 1
32 .globl ___gmpn_addmul_1
33 ___gmpn_addmul_1:
34         .word   0xfc0
35         movl    12(ap),r4
36         movl    8(ap),r8
37         movl    4(ap),r9
38         movl    16(ap),r6
39         jlss    s2_big
40
41         clrl    r3
42         incl    r4
43         ashl    $-1,r4,r7
44         jlbc    r4,L1
45         clrl    r11
46
47 # Loop for S2_LIMB < 0x80000000
48 Loop1:  movl    (r8)+,r1
49         jlss    L1n0
50         emul    r1,r6,$0,r2
51         addl2   r11,r2
52         adwc    $0,r3
53         addl2   r2,(r9)+
54         adwc    $0,r3
55 L1:     movl    (r8)+,r1
56         jlss    L1n1
57 L1p1:   emul    r1,r6,$0,r10
58         addl2   r3,r10
59         adwc    $0,r11
60         addl2   r10,(r9)+
61         adwc    $0,r11
62
63         sobgtr  r7,Loop1
64         movl    r11,r0
65         ret
66
67 L1n0:   emul    r1,r6,$0,r2
68         addl2   r11,r2
69         adwc    r6,r3
70         addl2   r2,(r9)+
71         adwc    $0,r3
72         movl    (r8)+,r1
73         jgeq    L1p1
74 L1n1:   emul    r1,r6,$0,r10
75         addl2   r3,r10
76         adwc    r6,r11
77         addl2   r10,(r9)+
78         adwc    $0,r11
79
80         sobgtr  r7,Loop1
81         movl    r11,r0
82         ret
83
84
85 s2_big: clrl    r3
86         incl    r4
87         ashl    $-1,r4,r7
88         jlbc    r4,L2
89         clrl    r11
90
91 # Loop for S2_LIMB >= 0x80000000
92 Loop2:  movl    (r8)+,r1
93         jlss    L2n0
94         emul    r1,r6,$0,r2
95         addl2   r11,r2
96         adwc    r1,r3
97         addl2   r2,(r9)+
98         adwc    $0,r3
99 L2:     movl    (r8)+,r1
100         jlss    L2n1
101 L2p1:   emul    r1,r6,$0,r10
102         addl2   r3,r10
103         adwc    r1,r11
104         addl2   r10,(r9)+
105         adwc    $0,r11
106
107         sobgtr  r7,Loop2
108         movl    r11,r0
109         ret
110
111 L2n0:   emul    r1,r6,$0,r2
112         addl2   r11,r2
113         adwc    r6,r3
114         addl2   r2,(r9)+
115         adwc    r1,r3
116         movl    (r8)+,r1
117         jgeq    L2p1
118 L2n1:   emul    r1,r6,$0,r10
119         addl2   r3,r10
120         adwc    r6,r11
121         addl2   r10,(r9)+
122         adwc    r1,r11
123
124         sobgtr  r7,Loop2
125         movl    r11,r0
126         ret