Tizen 2.1 base
[external/gmp.git] / mpn / vax / mul_1.s
1 # VAX __gmpn_mul_1 -- Multiply a limb vector with a limb and store
2 # the result in a second limb vector.
3
4 # Copyright 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 3 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.  If not, see http://www.gnu.org/licenses/.
20
21
22 # INPUT PARAMETERS
23 # res_ptr       (sp + 4)
24 # s1_ptr        (sp + 8)
25 # size          (sp + 12)
26 # s2_limb       (sp + 16)
27
28 .text
29         .align 1
30 .globl ___gmpn_mul_1
31 ___gmpn_mul_1:
32         .word   0xfc0
33         movl    12(ap),r4
34         movl    8(ap),r8
35         movl    4(ap),r9
36         movl    16(ap),r6
37         jlss    s2_big
38
39 # One might want to combine the addl2 and the store below, but that
40 # is actually just slower according to my timing tests.  (VAX 3600)
41
42         clrl    r3
43         incl    r4
44         ashl    $-1,r4,r7
45         jlbc    r4,L1
46         clrl    r11
47
48 # Loop for S2_LIMB < 0x80000000
49 Loop1:  movl    (r8)+,r1
50         jlss    L1n0
51         emul    r1,r6,$0,r2
52         addl2   r11,r2
53         adwc    $0,r3
54         movl    r2,(r9)+
55 L1:     movl    (r8)+,r1
56         jlss    L1n1
57 L1p1:   emul    r1,r6,$0,r10
58         addl2   r3,r10
59         adwc    $0,r11
60         movl    r10,(r9)+
61
62         sobgtr  r7,Loop1
63         movl    r11,r0
64         ret
65
66 L1n0:   emul    r1,r6,$0,r2
67         addl2   r11,r2
68         adwc    r6,r3
69         movl    r2,(r9)+
70         movl    (r8)+,r1
71         jgeq    L1p1
72 L1n1:   emul    r1,r6,$0,r10
73         addl2   r3,r10
74         adwc    r6,r11
75         movl    r10,(r9)+
76
77         sobgtr  r7,Loop1
78         movl    r11,r0
79         ret
80
81
82 s2_big: clrl    r3
83         incl    r4
84         ashl    $-1,r4,r7
85         jlbc    r4,L2
86         clrl    r11
87
88 # Loop for S2_LIMB >= 0x80000000
89 Loop2:  movl    (r8)+,r1
90         jlss    L2n0
91         emul    r1,r6,$0,r2
92         addl2   r11,r2
93         adwc    r1,r3
94         movl    r2,(r9)+
95 L2:     movl    (r8)+,r1
96         jlss    L2n1
97 L2p1:   emul    r1,r6,$0,r10
98         addl2   r3,r10
99         adwc    r1,r11
100         movl    r10,(r9)+
101
102         sobgtr  r7,Loop2
103         movl    r11,r0
104         ret
105
106 L2n0:   emul    r1,r6,$0,r2
107         addl2   r1,r3
108         addl2   r11,r2
109         adwc    r6,r3
110         movl    r2,(r9)+
111         movl    (r8)+,r1
112         jgeq    L2p1
113 L2n1:   emul    r1,r6,$0,r10
114         addl2   r1,r11
115         addl2   r3,r10
116         adwc    r6,r11
117         movl    r10,(r9)+
118
119         sobgtr  r7,Loop2
120         movl    r11,r0
121         ret