1 dnl HP-PA 7100/7200 mpn_addmul_1 -- Multiply a limb vector with a limb and
2 dnl add the result to a second limb vector.
4 dnl Copyright 1995, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
24 define(`res_ptr',`%r26')
25 define(`s1_ptr',`%r25')
26 define(`size_param',`%r24')
27 define(`s2_limb',`%r23')
29 define(`cylimb',`%r28')
39 define(`hi1',`%r23') C safe to reuse
44 PROLOGUE(mpn_addmul_1)
45 C .callinfo frame=128,no_calls
48 stws s2_limb,-16(%r30)
49 add %r0,%r0,cylimb C clear cy and cylimb
50 addib,< -4,size_param,L(few_limbs)
51 fldws -16(%r30),%fr31R
60 bb,>=,n s1_ptr,29,L(0)
62 fldws,ma 4(s1_ptr),%fr4
64 xmpyu %fr4,%fr31R,%fr5
69 addib,< -1,size_param,L(few_limbs)
72 C start software pipeline ----------------------------------------------------
74 fldds,ma 8(s1_ptr),%fr4
75 fldds,ma 8(s1_ptr),%fr8
77 xmpyu %fr4L,%fr31R,%fr5
78 xmpyu %fr4R,%fr31R,%fr6
79 xmpyu %fr8L,%fr31R,%fr9
80 xmpyu %fr8R,%fr31R,%fr10
101 addib,< -4,size_param,L(end)
102 addc %r0,hi3,cylimb C propagate carry into cylimb
103 C main loop ------------------------------------------------------------------
105 fldds,ma 8(s1_ptr),%fr4
106 fldds,ma 8(s1_ptr),%fr8
109 xmpyu %fr4L,%fr31R,%fr5
111 xmpyu %fr4R,%fr31R,%fr6
113 xmpyu %fr8L,%fr31R,%fr9
115 xmpyu %fr8R,%fr31R,%fr10
136 stws,ma s0,4(res_ptr)
138 stws,ma s1,4(res_ptr)
140 stws,ma s2,4(res_ptr)
142 stws,ma s3,4(res_ptr)
144 addib,>= -4,size_param,L(loop)
145 addc %r0,hi3,cylimb C propagate carry into cylimb
146 C finish software pipeline ---------------------------------------------------
154 stws,ma s0,4(res_ptr)
156 stws,ma s1,4(res_ptr)
158 stws,ma s2,4(res_ptr)
160 stws,ma s3,4(res_ptr)
162 C restore callee-saves registers ---------------------------------------------
170 addib,=,n 4,size_param,L(ret)
173 fldws,ma 4(s1_ptr),%fr4
175 xmpyu %fr4,%fr31R,%fr5
182 stws,ma s0,4(res_ptr)
183 addib,<> -1,size_param,L(loop2)
187 addc %r0,cylimb,cylimb
190 EPILOGUE(mpn_addmul_1)