1
/* PowerPC-32 submul_1 -- Multiply a limb vector with a limb and subtract
2
* the result from a second limb vector.
4
* Copyright (C) 1995, 1998 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"
27
#ifndef USE_PPC_PATCHES
31
* mpihelp_submul_1( mpi_ptr_t res_ptr, (r3)
32
* mpi_ptr_t s1_ptr, (r4)
33
* mpi_size_t s1_size, (r5)
34
* mpi_limb_t s2_limb) (r6)
36
* This is a fairly straightforward implementation. The timing of the PC601
37
* is hard to understand, so I will wait to optimize this until I have some
38
* hardware to play with.
40
* The code trivially generalizes to 64 bit limbs for the PC620.
44
.csect .mpihelp_submul_1[PR]
46
.globl mpihelp_submul_1
47
.globl .mpihelp_submul_1
48
.csect mpihelp_submul_1[DS]
50
.long .mpihelp_submul_1[PR], TOC[tc0], 0
51
.csect .mpihelp_submul_1[PR]
60
addc 7,7,8 # invert cy (r7 is junk)
72
addc 7,7,8 # invert cy (r7 is junk)
80
/* Multiply a limb vector by a single limb, for PowerPC.
81
Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
82
This file is part of the GNU C Library.
84
The GNU C Library is free software; you can redistribute it and/or
85
modify it under the terms of the GNU Library General Public License as
86
published by the Free Software Foundation; either version 2 of the
87
License, or (at your option) any later version.
89
The GNU C Library is distributed in the hope that it will be useful,
90
but WITHOUT ANY WARRANTY; without even the implied warranty of
91
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92
Library General Public License for more details.
94
You should have received a copy of the GNU Library General Public
95
License along with the GNU C Library; see the file COPYING.LIB. If not,
96
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
97
Boston, MA 02111-1307, USA. */
99
/* mp_limb_t mpn_submul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr,
100
mp_size_t s1_size, mp_limb_t s2_limb)
101
Calculate res-s1*s2 and put result back in res; return carry. */
103
ENTRY(mpihelp_submul_1)
111
addc %r7,%r7,%r8 # invert cy (r7 is junk)
112
addi %r3,%r3,-4 # adjust res_ptr
123
addc %r7,%r7,%r8 # invert cy (r7 is junk)
129
END(mpihelp_submul_1)