remove empty dir
[ghc-hetmet.git] / ghc / rts / gmp / 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 (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_mul_1
33 ___gmpn_mul_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 # One might want to combine the addl2 and the store below, but that
42 # is actually just slower according to my timing tests.  (VAX 3600)
43
44         clrl    r3
45         incl    r4
46         ashl    $-1,r4,r7
47         jlbc    r4,L1
48         clrl    r11
49
50 # Loop for S2_LIMB < 0x80000000
51 Loop1:  movl    (r8)+,r1
52         jlss    L1n0
53         emul    r1,r6,$0,r2
54         addl2   r11,r2
55         adwc    $0,r3
56         movl    r2,(r9)+
57 L1:     movl    (r8)+,r1
58         jlss    L1n1
59 L1p1:   emul    r1,r6,$0,r10
60         addl2   r3,r10
61         adwc    $0,r11
62         movl    r10,(r9)+
63
64         sobgtr  r7,Loop1
65         movl    r11,r0
66         ret
67
68 L1n0:   emul    r1,r6,$0,r2
69         addl2   r11,r2
70         adwc    r6,r3
71         movl    r2,(r9)+
72         movl    (r8)+,r1
73         jgeq    L1p1
74 L1n1:   emul    r1,r6,$0,r10
75         addl2   r3,r10
76         adwc    r6,r11
77         movl    r10,(r9)+
78
79         sobgtr  r7,Loop1
80         movl    r11,r0
81         ret
82
83
84 s2_big: clrl    r3
85         incl    r4
86         ashl    $-1,r4,r7
87         jlbc    r4,L2
88         clrl    r11
89
90 # Loop for S2_LIMB >= 0x80000000
91 Loop2:  movl    (r8)+,r1
92         jlss    L2n0
93         emul    r1,r6,$0,r2
94         addl2   r11,r2
95         adwc    r1,r3
96         movl    r2,(r9)+
97 L2:     movl    (r8)+,r1
98         jlss    L2n1
99 L2p1:   emul    r1,r6,$0,r10
100         addl2   r3,r10
101         adwc    r1,r11
102         movl    r10,(r9)+
103
104         sobgtr  r7,Loop2
105         movl    r11,r0
106         ret
107
108 L2n0:   emul    r1,r6,$0,r2
109         addl2   r1,r3
110         addl2   r11,r2
111         adwc    r6,r3
112         movl    r2,(r9)+
113         movl    (r8)+,r1
114         jgeq    L2p1
115 L2n1:   emul    r1,r6,$0,r10
116         addl2   r1,r11
117         addl2   r3,r10
118         adwc    r6,r11
119         movl    r10,(r9)+
120
121         sobgtr  r7,Loop2
122         movl    r11,r0
123         ret