1
/* IBM POWER submul_1 -- Multiply a limb vector with a limb and subtract
2
* the result from 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"
35
# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction. To
36
# obtain that operation, we have to use the 32x32->64 signed multiplication
37
# instruction, and add the appropriate compensation to the high limb of the
38
# result. We add the multiplicand if the multiplier has its most significant
39
# bit set, and we add the multiplier if the multiplicand has its most
40
# significant bit set. We need to preserve the carry flag between each
41
# iteration, so we have to compute the compensation carefully (the natural,
42
# srai+and doesn't work). Since the POWER architecture has a branch unit
43
# we can branch in zero cycles, so that's how we perform the additions.
47
.csect .mpihelp_submul_1[PR]
49
.globl mpihelp_submul_1
50
.globl .mpihelp_submul_1
51
.csect mpihelp_submul_1[DS]
53
.long .mpihelp_submul_1[PR], TOC[tc0], 0
54
.csect .mpihelp_submul_1[PR]
67
sf 8,11,7 # add res_limb
68
a 11,8,11 # invert cy (r11 is junk)
77
ae 11,0,9 # low limb + old_cy_limb + old cy
79
aze 10,10 # propagate cy to new cy_limb
80
sf 8,11,7 # add res_limb
81
a 11,8,11 # invert cy (r11 is junk)
83
cax 10,10,6 # adjust high limb for negative limb from s1
94
a 11,8,11 # invert cy (r11 is junk)
96
cax 9,9,6 # adjust high limb for negative limb from s1
110
ae 10,10,0 # propagate cy to new cy_limb
111
sf 8,11,7 # add res_limb
112
a 11,8,11 # invert cy (r11 is junk)
114
cax 10,10,6 # adjust high limb for negative limb from s1
123
ae 9,9,0 # propagate cy to new cy_limb
124
sf 8,11,7 # add res_limb
125
a 11,8,11 # invert cy (r11 is junk)
127
cax 9,9,6 # adjust high limb for negative limb from s1