1
/* IBM POWER mul_1 -- Multiply a limb vector with a limb and store
2
* the result in a second limb vector.
4
* Copyright (C) 1992, 1994, 1999 Free Software Foundation, Inc.
6
* This file is part of GnuPG.
8
* GnuPG is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* GnuPG is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
24
#include "asm-syntax.h"
33
# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction. To
34
# obtain that operation, we have to use the 32x32->64 signed multiplication
35
# instruction, and add the appropriate compensation to the high limb of the
36
# result. We add the multiplicand if the multiplier has its most significant
37
# bit set, and we add the multiplier if the multiplicand has its most
38
# significant bit set. We need to preserve the carry flag between each
39
# iteration, so we have to compute the compensation carefully (the natural,
40
# srai+and doesn't work). Since the POWER architecture has a branch unit
41
# we can branch in zero cycles, so that's how we perform the additions.
45
.csect .mpihelp_mul_1[PR]
49
.csect mpihelp_mul_1[DS]
51
.long .mpihelp_mul_1[PR], TOC[tc0], 0
52
.csect .mpihelp_mul_1[PR]
63
ai 0,0,0 # reset carry
74
cax 10,10,6 # adjust high limb for negative limb from s1
83
cax 9,9,6 # adjust high limb for negative limb from s1
93
cax 10,10,0 # adjust high limb for negative s2_limb
97
cax 10,10,6 # adjust high limb for negative limb from s1
103
cax 9,9,0 # adjust high limb for negative s2_limb
107
cax 9,9,6 # adjust high limb for negative limb from s1