Debian Codegraph @

mpi/sparc32v8/mpih-mul3.S

raw
1 /* SPARC v8 __mpn_submul_1 -- Multiply a limb vector with a limb and
2 * subtract the result from a second limb vector.
3 *
4 * Copyright (C) 1992, 1993, 1994, 1998,
5 * 2001, 2002 Free Software Foundation, Inc.
6 *
7 * This file is part of Libgcrypt.
8 *
9 * Libgcrypt is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
13 *
14 * Libgcrypt is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, see <https://www.gnu.org/licenses/>.
21 * SPDX-License-Identifier: LGPL-2.1-or-later
22 *
23 * Note: This code is heavily based on the GNU MP Library.
24 * Actually it's the same code with only minor changes in the
25 * way the data is stored; this is to support the abstraction
26 * of an optional secure memory allocation which may be used
27 * to avoid revealing of sensitive data due to paging etc.
28 */
29
30
31 ! INPUT PARAMETERS
32 ! res_ptr o0
33 ! s1_ptr o1
34 ! size o2
35 ! s2_limb o3
36
37 #include "sysdep.h"
38
39 .text
40 .align 4
41 .global C_SYMBOL_NAME(_gcry_mpih_submul_1)
42 C_SYMBOL_NAME(_gcry_mpih_submul_1):
43 sub %g0,%o2,%o2 ! negate ...
44 sll %o2,2,%o2 ! ... and scale size
45 sub %o1,%o2,%o1 ! o1 is offset s1_ptr
46 sub %o0,%o2,%g1 ! g1 is offset res_ptr
47
48 mov 0,%o0 ! clear cy_limb
49
50 Loop: ld [%o1+%o2],%o4
51 ld [%g1+%o2],%g2
52 umul %o4,%o3,%o5
53 rd %y,%g3
54 addcc %o5,%o0,%o5
55 addx %g3,0,%o0
56 subcc %g2,%o5,%g2
57 addx %o0,0,%o0
58 st %g2,[%g1+%o2]
59
60 addcc %o2,4,%o2
61 bne Loop
62 nop
63
64 retl
65 nop
66
67