Rewritten.
[glibc.git] / sysdeps / vax / mul_1.s
blob3fe375bacfde18c32f14472182dc00b594d0e37d
1 # VAX __mpn_mul_1 -- Multiply a limb vector with a limb and store
2 # the result in a second limb vector.
4 # Copyright (C) 1992, 1994 Free Software Foundation, Inc.
6 # This file is part of the GNU MP Library.
8 # The GNU MP Library is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Library General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at your
11 # option) any later version.
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 Library General Public
16 # License for more details.
18 # You should have received a copy of the GNU Library 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., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # INPUT PARAMETERS
24 # res_ptr (sp + 4)
25 # s1_ptr (sp + 8)
26 # size (sp + 12)
27 # s2_limb (sp + 16)
29 .text
30 .align 1
31 .globl ___mpn_mul_1
32 ___mpn_mul_1:
33 .word 0xfc0
34 movl 12(ap),r4
35 movl 8(ap),r8
36 movl 4(ap),r9
37 movl 16(ap),r6
38 jlss s2_big
40 # One might want to combine the addl2 and the store below, but that
41 # is actually just slower according to my timing tests. (VAX 3600)
43 clrl r3
44 incl r4
45 ashl $-1,r4,r7
46 jlbc r4,L1
47 clrl r11
49 # Loop for S2_LIMB < 0x80000000
50 Loop1: movl (r8)+,r1
51 jlss L1n0
52 emul r1,r6,$0,r2
53 addl2 r11,r2
54 adwc $0,r3
55 movl r2,(r9)+
56 L1: movl (r8)+,r1
57 jlss L1n1
58 L1p1: emul r1,r6,$0,r10
59 addl2 r3,r10
60 adwc $0,r11
61 movl r10,(r9)+
63 jsobgtr r7,Loop1
64 movl r11,r0
65 ret
67 L1n0: emul r1,r6,$0,r2
68 addl2 r11,r2
69 adwc r6,r3
70 movl r2,(r9)+
71 movl (r8)+,r1
72 jgeq L1p1
73 L1n1: emul r1,r6,$0,r10
74 addl2 r3,r10
75 adwc r6,r11
76 movl r10,(r9)+
78 jsobgtr r7,Loop1
79 movl r11,r0
80 ret
83 s2_big: clrl r3
84 incl r4
85 ashl $-1,r4,r7
86 jlbc r4,L2
87 clrl r11
89 # Loop for S2_LIMB >= 0x80000000
90 Loop2: movl (r8)+,r1
91 jlss L2n0
92 emul r1,r6,$0,r2
93 addl2 r11,r2
94 adwc r1,r3
95 movl r2,(r9)+
96 L2: movl (r8)+,r1
97 jlss L2n1
98 L2p1: emul r1,r6,$0,r10
99 addl2 r3,r10
100 adwc r1,r11
101 movl r10,(r9)+
103 jsobgtr r7,Loop2
104 movl r11,r0
107 L2n0: emul r1,r6,$0,r2
108 addl2 r1,r3
109 addl2 r11,r2
110 adwc r6,r3
111 movl r2,(r9)+
112 movl (r8)+,r1
113 jgeq L2p1
114 L2n1: emul r1,r6,$0,r10
115 addl2 r1,r11
116 addl2 r3,r10
117 adwc r6,r11
118 movl r10,(r9)+
120 jsobgtr r7,Loop2
121 movl r11,r0