beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / pa32 / hppa2_0 / add_n.asm
blob8d881b8b0862577780be201e443106f6d06cd506
1 dnl HP-PA 2.0 32-bit mpn_add_n -- Add two limb vectors of the same length > 0
2 dnl and store sum in a third limb vector.
4 dnl Copyright 1997, 1998, 2000-2002 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
7 dnl
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of either:
10 dnl
11 dnl * the GNU Lesser General Public License as published by the Free
12 dnl Software Foundation; either version 3 of the License, or (at your
13 dnl option) any later version.
14 dnl
15 dnl or
16 dnl
17 dnl * the GNU General Public License as published by the Free Software
18 dnl Foundation; either version 2 of the License, or (at your option) any
19 dnl later version.
20 dnl
21 dnl or both in parallel, as here.
22 dnl
23 dnl The GNU MP Library is distributed in the hope that it will be useful, but
24 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 dnl for more details.
27 dnl
28 dnl You should have received copies of the GNU General Public License and the
29 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
30 dnl see https://www.gnu.org/licenses/.
32 include(`../config.m4')
34 C INPUT PARAMETERS
35 C res_ptr gr26
36 C s1_ptr gr25
37 C s2_ptr gr24
38 C size gr23
40 C This runs at 2 cycles/limb on PA8000.
42 ASM_START()
43 PROLOGUE(mpn_add_n)
44 sub %r0,%r23,%r22
45 zdep %r22,30,3,%r28 C r28 = 2 * (-n & 7)
46 zdep %r22,29,3,%r22 C r22 = 4 * (-n & 7)
47 sub %r25,%r22,%r25 C offset s1_ptr
48 sub %r24,%r22,%r24 C offset s2_ptr
49 sub %r26,%r22,%r26 C offset res_ptr
50 blr %r28,%r0 C branch into loop
51 add %r0,%r0,%r0 C reset carry
53 LDEF(loop)
54 ldw 0(%r25),%r20
55 ldw 0(%r24),%r31
56 addc %r20,%r31,%r20
57 stw %r20,0(%r26)
59 LDEF(7)
60 ldw 4(%r25),%r21
61 ldw 4(%r24),%r19
62 addc %r21,%r19,%r21
63 stw %r21,4(%r26)
65 LDEF(6)
66 ldw 8(%r25),%r20
67 ldw 8(%r24),%r31
68 addc %r20,%r31,%r20
69 stw %r20,8(%r26)
71 LDEF(5)
72 ldw 12(%r25),%r21
73 ldw 12(%r24),%r19
74 addc %r21,%r19,%r21
75 stw %r21,12(%r26)
77 LDEF(4)
78 ldw 16(%r25),%r20
79 ldw 16(%r24),%r31
80 addc %r20,%r31,%r20
81 stw %r20,16(%r26)
83 LDEF(3)
84 ldw 20(%r25),%r21
85 ldw 20(%r24),%r19
86 addc %r21,%r19,%r21
87 stw %r21,20(%r26)
89 LDEF(2)
90 ldw 24(%r25),%r20
91 ldw 24(%r24),%r31
92 addc %r20,%r31,%r20
93 stw %r20,24(%r26)
95 LDEF(1)
96 ldw 28(%r25),%r21
97 ldo 32(%r25),%r25
98 ldw 28(%r24),%r19
99 addc %r21,%r19,%r21
100 stw %r21,28(%r26)
101 ldo 32(%r24),%r24
102 addib,> -8,%r23,L(loop)
103 ldo 32(%r26),%r26
105 bv (%r2)
106 addc %r0,%r0,%r28
107 EPILOGUE()