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
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
35 C 8500,8600,8700: 1.75
38 C * Write special feed-in code for each (n mod 8). (See the ia64 code.)
39 C * Try to make this run at closer to 1.5 c/l.
40 C * Set up register aliases (define(`u0',`
%r19
')).
41 C * Explicitly align loop.
49 ifdef(`OPERATION_addlsh1_n',`
50 define
(ADCSBC
, `
add,dc
')
51 define(INITC, `ldi 0,')
52 define
(func
, mpn_addlsh1_n
)
54 ifdef(`OPERATION_sublsh1_n',`
55 define
(ADCSBC
, `
sub,db')
56 define(INITC, `ldi 1,')
57 define
(func
, mpn_sublsh1_n
)
60 MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
62 ifdef(`HAVE_ABI_2_0w',`
63 define
(LEVEL
, `.level
2.0w
')
64 define(RETREG, `%r28')
65 define
(CLRRET1
, `dnl
')
67 ifdef
(`HAVE_ABI_2_0n
',`
68 define(LEVEL, `.level 2.0')
69 define
(RETREG
, `
%r29
')
70 define(CLRRET1, `ldi 0, %r28')
75 std,ma %r3, 0x100(%r30) C save reg
77 INITC %r1 C init saved cy
79 C Primitive code for the first (n mod 8) limbs:
80 extrd,u n, 63, 3, %r22 C count for loop0
81 comib,= 0, %r22, L(unrolled) C skip loop0?
88 shrpd %r21, %r28, 63, %r31
89 addi -1, %r1, %r0 C restore cy
90 ADCSBC %r19, %r31, %r29
92 add,dc %r0, %r0, %r1 C save cy
94 addib,> -1, %r22, L(loop0)
97 addib,>= -8, n, L(unrolled)
98 addi -1, %r1, %r0 C restore cy
100 shrpd %r0, %r28, 63, %r28
101 ADCSBC %r0, %r28, RETREG
102 ifdef(`OPERATION_sublsh1_n',
103 `
sub %r0
, RETREG
, RETREG
')
107 ldd,mb -0x100(%r30), %r3
111 std %r4, -0xf8(%r30) C save reg
113 std %r5, -0xf0(%r30) C save reg
115 std %r6, -0xe8(%r30) C save reg
117 std %r7, -0xe0(%r30) C save reg
120 shrpd %r4, %r28, 63, %r31
121 std %r8, -0xd8(%r30) C save reg
123 shrpd %r5, %r4, 63, %r4
124 std %r9, -0xd0(%r30) C save reg
126 shrpd %r6, %r5, 63, %r5
128 shrpd %r7, %r6, 63, %r6
130 shrpd %r8, %r7, 63, %r7
132 shrpd %r9, %r8, 63, %r8
134 shrpd %r3, %r9, 63, %r9
136 shrpd %r28, %r3, 63, %r3
139 nop C alignment FIXME
140 addib,<= -8, n, L(end)
141 addi -1, %r1, %r0 C restore cy
143 ADCSBC %r19, %r31, %r29
146 ADCSBC %r20, %r4, %r29
149 ADCSBC %r21, %r5, %r29
152 ADCSBC %r22, %r6, %r29
155 ADCSBC %r19, %r7, %r29
158 ADCSBC %r20, %r8, %r29
161 ADCSBC %r21, %r9, %r29
164 ADCSBC %r22, %r3, %r29
167 add,dc %r0, %r0, %r1 C save cy
170 shrpd %r4, %r28, 63, %r31
172 shrpd %r5, %r4, 63, %r4
174 shrpd %r6, %r5, 63, %r5
176 shrpd %r7, %r6, 63, %r6
178 shrpd %r8, %r7, 63, %r7
180 shrpd %r9, %r8, 63, %r8
182 shrpd %r3, %r9, 63, %r9
184 shrpd %r28, %r3, 63, %r3
190 addib,> -8, n, L(loop)
191 addi -1, %r1, %r0 C restore cy
193 ADCSBC %r19, %r31, %r29
196 ADCSBC %r20, %r4, %r29
199 ADCSBC %r21, %r5, %r29
202 ADCSBC %r22, %r6, %r29
205 ADCSBC %r19, %r7, %r29
206 ldd -0xf8(%r30), %r4 C restore reg
208 ADCSBC %r20, %r8, %r29
209 ldd -0xf0(%r30), %r5 C restore reg
211 ADCSBC %r21, %r9, %r29
212 ldd -0xe8(%r30), %r6 C restore reg
214 ADCSBC %r22, %r3, %r29
215 ldd -0xe0(%r30), %r7 C restore reg
218 shrpd %r0, %r28, 63, %r28
219 ldd -0xd8(%r30), %r8 C restore reg
220 ADCSBC %r0, %r28, RETREG
221 ifdef(`OPERATION_sublsh1_n',
222 `
sub %r0
, RETREG
, RETREG
')
225 ldd -0xd0(%r30), %r9 C restore reg
227 ldd,mb -0x100(%r30), %r3 C restore reg