Rewritten.
[glibc.git] / sysdeps / vax / addmul_1.s
blob8e83204b814853d4b0cad98dc16c2d787e6e48a1
1 # VAX __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2 # the result to 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_addmul_1
32 ___mpn_addmul_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 clrl r3
41 incl r4
42 ashl $-1,r4,r7
43 jlbc r4,L1
44 clrl r11
46 # Loop for S2_LIMB < 0x80000000
47 Loop1: movl (r8)+,r1
48 jlss L1n0
49 emul r1,r6,$0,r2
50 addl2 r11,r2
51 adwc $0,r3
52 addl2 r2,(r9)+
53 adwc $0,r3
54 L1: movl (r8)+,r1
55 jlss L1n1
56 L1p1: emul r1,r6,$0,r10
57 addl2 r3,r10
58 adwc $0,r11
59 addl2 r10,(r9)+
60 adwc $0,r11
62 jsobgtr r7,Loop1
63 movl r11,r0
64 ret
66 L1n0: emul r1,r6,$0,r2
67 addl2 r11,r2
68 adwc r6,r3
69 addl2 r2,(r9)+
70 adwc $0,r3
71 movl (r8)+,r1
72 jgeq L1p1
73 L1n1: emul r1,r6,$0,r10
74 addl2 r3,r10
75 adwc r6,r11
76 addl2 r10,(r9)+
77 adwc $0,r11
79 jsobgtr r7,Loop1
80 movl r11,r0
81 ret
84 s2_big: clrl r3
85 incl r4
86 ashl $-1,r4,r7
87 jlbc r4,L2
88 clrl r11
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 addl2 r2,(r9)+
97 adwc $0,r3
98 L2: movl (r8)+,r1
99 jlss L2n1
100 L2p1: emul r1,r6,$0,r10
101 addl2 r3,r10
102 adwc r1,r11
103 addl2 r10,(r9)+
104 adwc $0,r11
106 jsobgtr r7,Loop2
107 movl r11,r0
110 L2n0: emul r1,r6,$0,r2
111 addl2 r11,r2
112 adwc r6,r3
113 addl2 r2,(r9)+
114 adwc r1,r3
115 movl (r8)+,r1
116 jgeq L2p1
117 L2n1: emul r1,r6,$0,r10
118 addl2 r3,r10
119 adwc r6,r11
120 addl2 r10,(r9)+
121 adwc r1,r11
123 jsobgtr r7,Loop2
124 movl r11,r0