1
dnl IBM POWER mpn_addmul_1 -- Multiply a limb vector with a limb and add the
2
dnl result to a second limb vector.
4
dnl Copyright 1992, 1994, 1999, 2000, 2001 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 2.1 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; see the file COPYING.LIB. If not, write to
20
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21
dnl MA 02111-1307, USA.
30
dnl The POWER architecture has no unsigned 32x32->64 bit multiplication
31
dnl instruction. To obtain that operation, we have to use the 32x32->64
32
dnl signed multiplication instruction, and add the appropriate compensation to
33
dnl the high limb of the result. We add the multiplicand if the multiplier
34
dnl has its most significant bit set, and we add the multiplier if the
35
dnl multiplicand has its most significant bit set. We need to preserve the
36
dnl carry flag between each iteration, so we have to compute the compensation
37
dnl carefully (the natural, srai+and doesn't work). Since all POWER can
38
dnl branch in zero cycles, we use conditional branches to for the additions.
40
include(`../config.m4')
43
PROLOGUE(mpn_addmul_1)
54
a 8,8,7 C add res_limb
63
ae 8,0,9 C low limb + old_cy_limb + old cy
65
aze 10,10 C propagate cy to new cy_limb
66
a 8,8,7 C add res_limb
68
cax 10,10,6 C adjust high limb for negative limb from s1
80
cax 9,9,6 C adjust high limb for negative limb from s1
94
ae 10,10,0 C propagate cy to new cy_limb
95
a 8,8,7 C add res_limb
97
cax 10,10,6 C adjust high limb for negative limb from s1
106
ae 9,9,0 C propagate cy to new cy_limb
107
a 8,8,7 C add res_limb
109
cax 9,9,6 C adjust high limb for negative limb from s1
117
EPILOGUE(mpn_addmul_1)