1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
dnl Alpha mpn_add_n -- Add two limb vectors of the same length > 0 and
dnl store sum in a third limb vector.
dnl Copyright (C) 1995, 2000 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published by
dnl the Free Software Foundation; either version 2.1 of the License, or (at your
dnl option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
dnl MA 02111-1307, USA.
include(`../config.m4')
dnl INPUT PARAMETERS
dnl res_ptr r16
dnl s1_ptr r17
dnl s2_ptr r18
dnl size r19
ASM_START()
PROLOGUE(mpn_add_n)
ldq r3,0(r17)
ldq r4,0(r18)
subq r19,1,r19
and r19,4-1,r2 C number of limbs in first loop
bis r31,r31,r0
beq r2,$L0 C if multiple of 4 limbs, skip first loop
subq r19,r2,r19
$Loop0: subq r2,1,r2
ldq r5,8(r17)
addq r4,r0,r4
ldq r6,8(r18)
cmpult r4,r0,r1
addq r3,r4,r4
cmpult r4,r3,r0
stq r4,0(r16)
bis r0,r1,r0
addq r17,8,r17
addq r18,8,r18
bis r5,r5,r3
bis r6,r6,r4
addq r16,8,r16
bne r2,$Loop0
$L0: beq r19,$Lend
ALIGN(8)
$Loop: subq r19,4,r19
ldq r5,8(r17)
addq r4,r0,r4
ldq r6,8(r18)
cmpult r4,r0,r1
addq r3,r4,r4
cmpult r4,r3,r0
stq r4,0(r16)
bis r0,r1,r0
ldq r3,16(r17)
addq r6,r0,r6
ldq r4,16(r18)
cmpult r6,r0,r1
addq r5,r6,r6
cmpult r6,r5,r0
stq r6,8(r16)
bis r0,r1,r0
ldq r5,24(r17)
addq r4,r0,r4
ldq r6,24(r18)
cmpult r4,r0,r1
addq r3,r4,r4
cmpult r4,r3,r0
stq r4,16(r16)
bis r0,r1,r0
ldq r3,32(r17)
addq r6,r0,r6
ldq r4,32(r18)
cmpult r6,r0,r1
addq r5,r6,r6
cmpult r6,r5,r0
stq r6,24(r16)
bis r0,r1,r0
addq r17,32,r17
addq r18,32,r18
addq r16,32,r16
bne r19,$Loop
$Lend: addq r4,r0,r4
cmpult r4,r0,r1
addq r3,r4,r4
cmpult r4,r3,r0
stq r4,0(r16)
bis r0,r1,r0
ret r31,(r26),1
EPILOGUE(mpn_add_n)
ASM_END()
|