1 dnl PA64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
3 dnl Copyright 2003 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
24 C 8500,8600,8700: 1.75
27 C * Write special feed-in code for each (n mod 8). (See the ia64 code.)
28 C * Try to make this run at closer to 1.5 c/l.
29 C * Set up register aliases (define(`u0',`%r19')).
30 C * Explicitly align loop.
38 ifdef(`OPERATION_addlsh1_n',`
39 define(ADCSBC, `add,dc')
40 define(INITC, `ldi 0,')
41 define(func, mpn_addlsh1_n)
43 ifdef(`OPERATION_sublsh1_n',`
44 define(ADCSBC, `sub,db')
45 define(INITC, `ldi 1,')
46 define(func, mpn_sublsh1_n)
49 MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
51 ifdef(`HAVE_ABI_2_0w',`
52 define(LEVEL, `.level 2.0w')
53 define(RETREG, `%r28')
54 define(CLRRET1, `dnl')
56 ifdef(`HAVE_ABI_2_0n',`
57 define(LEVEL, `.level 2.0')
58 define(RETREG, `%r29')
59 define(CLRRET1, `ldi 0, %r28')
64 std,ma %r3, 0x100(%r30) C save reg
66 INITC %r1 C init saved cy
68 C Primitive code for the first (n mod 8) limbs:
69 extrd,u n, 63, 3, %r22 C count for loop0
70 comib,= 0, %r22, L(unrolled) C skip loop0?
77 shrpd %r21, %r28, 63, %r31
78 addi -1, %r1, %r0 C restore cy
79 ADCSBC %r19, %r31, %r29
81 add,dc %r0, %r0, %r1 C save cy
83 addib,> -1, %r22, L(loop0)
86 addib,>= -8, n, L(unrolled)
87 addi -1, %r1, %r0 C restore cy
89 shrpd %r0, %r28, 63, %r28
90 ADCSBC %r0, %r28, RETREG
91 ifdef(`OPERATION_sublsh1_n',
92 ` sub %r0, RETREG, RETREG')
96 ldd,mb -0x100(%r30), %r3
100 std %r4, -0xf8(%r30) C save reg
102 std %r5, -0xf0(%r30) C save reg
104 std %r6, -0xe8(%r30) C save reg
106 std %r7, -0xe0(%r30) C save reg
109 shrpd %r4, %r28, 63, %r31
110 std %r8, -0xd8(%r30) C save reg
112 shrpd %r5, %r4, 63, %r4
113 std %r9, -0xd0(%r30) C save reg
115 shrpd %r6, %r5, 63, %r5
117 shrpd %r7, %r6, 63, %r6
119 shrpd %r8, %r7, 63, %r7
121 shrpd %r9, %r8, 63, %r8
123 shrpd %r3, %r9, 63, %r9
125 shrpd %r28, %r3, 63, %r3
128 nop C alignment FIXME
129 addib,<= -8, n, L(end)
130 addi -1, %r1, %r0 C restore cy
132 ADCSBC %r19, %r31, %r29
135 ADCSBC %r20, %r4, %r29
138 ADCSBC %r21, %r5, %r29
141 ADCSBC %r22, %r6, %r29
144 ADCSBC %r19, %r7, %r29
147 ADCSBC %r20, %r8, %r29
150 ADCSBC %r21, %r9, %r29
153 ADCSBC %r22, %r3, %r29
156 add,dc %r0, %r0, %r1 C save cy
159 shrpd %r4, %r28, 63, %r31
161 shrpd %r5, %r4, 63, %r4
163 shrpd %r6, %r5, 63, %r5
165 shrpd %r7, %r6, 63, %r6
167 shrpd %r8, %r7, 63, %r7
169 shrpd %r9, %r8, 63, %r8
171 shrpd %r3, %r9, 63, %r9
173 shrpd %r28, %r3, 63, %r3
179 addib,> -8, n, L(loop)
180 addi -1, %r1, %r0 C restore cy
182 ADCSBC %r19, %r31, %r29
185 ADCSBC %r20, %r4, %r29
188 ADCSBC %r21, %r5, %r29
191 ADCSBC %r22, %r6, %r29
194 ADCSBC %r19, %r7, %r29
195 ldd -0xf8(%r30), %r4 C restore reg
197 ADCSBC %r20, %r8, %r29
198 ldd -0xf0(%r30), %r5 C restore reg
200 ADCSBC %r21, %r9, %r29
201 ldd -0xe8(%r30), %r6 C restore reg
203 ADCSBC %r22, %r3, %r29
204 ldd -0xe0(%r30), %r7 C restore reg
207 shrpd %r0, %r28, 63, %r28
208 ldd -0xd8(%r30), %r8 C restore reg
209 ADCSBC %r0, %r28, RETREG
210 ifdef(`OPERATION_sublsh1_n',
211 ` sub %r0, RETREG, RETREG')
214 ldd -0xd0(%r30), %r9 C restore reg
216 ldd,mb -0x100(%r30), %r3 C restore reg