1 dnl HP-PA 2.0 mpn_add_n, mpn_sub_n
3 dnl Copyright 1997, 2000, 2002, 2003, 2009 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/.
21 dnl This runs at 2 cycles/limb on PA8000 and 1.6875 cycles/limb on PA8500. It
22 dnl should be possible to reach the cache bandwidth 1.5 cycles/limb at least
23 dnl with PA8500. The problem now is stalling of the first ADD,DC after LDO,
24 dnl where the processor gets confused about where carry comes from.
26 include(`../config.m4')
34 ifdef(`OPERATION_add_n', `
35 define(ADCSBC, `add,dc')
36 define(INITCY, `addi -1,%r22,%r0')
37 define(func, mpn_add_n)
38 define(func_nc, mpn_add_nc)')
39 ifdef(`OPERATION_sub_n', `
40 define(ADCSBC, `sub,db')
41 define(INITCY, `subi 0,%r22,%r0')
42 define(func, mpn_sub_n)
43 define(func_nc, mpn_sub_nc)')
45 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
47 ifdef(`HAVE_ABI_2_0w',
59 depw,z %r21, 30, 3, %r28 C r28 = 2 * (-n & 7)
60 depw,z %r21, 28, 3, %r21 C r21 = 8 * (-n & 7)
61 sub up, %r21, up C offset up
62 sub vp, %r21, vp C offset vp
63 sub rp, %r21, rp C offset rp
64 blr %r28, %r0 C branch into loop
70 ADCSBC %r20, %r31, %r20
72 LDEF(7) ldd 8(up), %r21
74 ADCSBC %r21, %r19, %r21
76 LDEF(6) ldd 16(up), %r20
78 ADCSBC %r20, %r31, %r20
80 LDEF(5) ldd 24(up), %r21
82 ADCSBC %r21, %r19, %r21
84 LDEF(4) ldd 32(up), %r20
86 ADCSBC %r20, %r31, %r20
88 LDEF(3) ldd 40(up), %r21
90 ADCSBC %r21, %r19, %r21
92 LDEF(2) ldd 48(up), %r20
94 ADCSBC %r20, %r31, %r20
96 LDEF(1) ldd 56(up), %r21
98 ADCSBC %r21, %r19, %r21
102 addib,> -8, n, L(loop)
105 add,dc %r0, %r0, %r29
106 ifdef(`OPERATION_sub_n',`
110 ifdef(`HAVE_ABI_2_0w',