]>
Commit | Line | Data |
---|---|---|
3b84e62e RM |
1 | /* mc68020 __mpn_addmul_1 -- Multiply a limb vector with a limb and add |
2 | the result to a second limb vector. | |
3 | ||
d4697bc9 | 4 | Copyright (C) 1992-2014 Free Software Foundation, Inc. |
3b84e62e RM |
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 | |
f01ec467 AJ |
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 | |
3b84e62e RM |
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 | |
f01ec467 | 15 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
3b84e62e RM |
16 | License for more details. |
17 | ||
f01ec467 | 18 | You should have received a copy of the GNU Lesser General Public License |
ab84e3ff | 19 | along with the GNU MP Library. If not, see <http://www.gnu.org/licenses/>. */ |
3b84e62e RM |
20 | |
21 | /* | |
22 | INPUT PARAMETERS | |
23 | res_ptr (sp + 4) | |
24 | s1_ptr (sp + 8) | |
3de9f02e | 25 | s1_size (sp + 12) |
3b84e62e RM |
26 | s2_limb (sp + 16) |
27 | */ | |
28 | ||
3de9f02e | 29 | #include "sysdep.h" |
3b84e62e RM |
30 | #include "asm-syntax.h" |
31 | ||
32 | TEXT | |
56d7f029 | 33 | ENTRY(__mpn_addmul_1) |
3b84e62e RM |
34 | |
35 | #define res_ptr a0 | |
36 | #define s1_ptr a1 | |
3de9f02e | 37 | #define s1_size d2 |
3b84e62e RM |
38 | #define s2_limb d4 |
39 | ||
40 | /* Save used registers on the stack. */ | |
3de9f02e | 41 | moveml R(d2)-R(d5),MEM_PREDEC(sp) |
50e73d13 AS |
42 | cfi_adjust_cfa_offset (4*4) |
43 | cfi_rel_offset (R(d2), 0) | |
44 | cfi_rel_offset (R(d3), 4) | |
45 | cfi_rel_offset (R(d4), 8) | |
46 | cfi_rel_offset (R(d5), 12) | |
3b84e62e RM |
47 | |
48 | /* Copy the arguments to registers. Better use movem? */ | |
3de9f02e RM |
49 | movel MEM_DISP(sp,20),R(res_ptr) |
50 | movel MEM_DISP(sp,24),R(s1_ptr) | |
51 | movel MEM_DISP(sp,28),R(s1_size) | |
52 | movel MEM_DISP(sp,32),R(s2_limb) | |
53 | ||
54 | eorw #1,R(s1_size) | |
55 | clrl R(d1) | |
56 | clrl R(d5) | |
57 | lsrl #1,R(s1_size) | |
58 | bcc L(L1) | |
59 | subql #1,R(s1_size) | |
60 | subl R(d0),R(d0) /* (d0,cy) <= (0,0) */ | |
61 | ||
62 | L(Loop:) | |
63 | movel MEM_POSTINC(s1_ptr),R(d3) | |
64 | mulul R(s2_limb),R(d1):R(d3) | |
65 | addxl R(d0),R(d3) | |
66 | addxl R(d5),R(d1) | |
67 | addl R(d3),MEM_POSTINC(res_ptr) | |
68 | L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) | |
69 | mulul R(s2_limb),R(d0):R(d3) | |
70 | addxl R(d1),R(d3) | |
71 | addxl R(d5),R(d0) | |
72 | addl R(d3),MEM_POSTINC(res_ptr) | |
73 | ||
74 | dbf R(s1_size),L(Loop) | |
75 | addxl R(d5),R(d0) | |
76 | subl #0x10000,R(s1_size) | |
77 | bcc L(Loop) | |
3b84e62e RM |
78 | |
79 | /* Restore used registers from stack frame. */ | |
3de9f02e | 80 | moveml MEM_POSTINC(sp),R(d2)-R(d5) |
50e73d13 AS |
81 | cfi_adjust_cfa_offset (-4*4) |
82 | cfi_restore (R(d2)) | |
83 | cfi_restore (R(d3)) | |
84 | cfi_restore (R(d4)) | |
85 | cfi_restore (R(d5)) | |
3b84e62e RM |
86 | |
87 | rts | |
56d7f029 | 88 | END(__mpn_addmul_1) |