File: mp32opt.sparcv8.S

package info (click to toggle)
beecrypt 2.2.0-pre1-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,820 kB
  • ctags: 1,325
  • sloc: ansic: 12,215; sh: 9,073; asm: 2,715; makefile: 80
file content (114 lines) | stat: -rw-r--r-- 2,555 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * mp32opt.sparcv8.S
 *
 * Assembler optimized multiprecision integer routines for Sparc v8
 *
 * Compile target is GNU Assembler, Sun Solaris Assembler
 *
 * Copyright (c) 2001 Virtual Unlimited B.V.
 *
 * Author: Bob Deblier <bob@virtualunlimited.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "beecrypt.gas.h"

	.file "mp32opt.sparcv8.S"

	.text

C_FUNCTION_BEGIN(mp32setmul)
LABEL(mp32setmul)

	.register %g2,#scratch

	sll %o0,2,%g1
	dec 4,%o2
	clr %o0
LOCAL(mp32setmul_loop):
	ld [%o2+%g1],%g2
	umul %o3,%g2,%g2
	rd %y,%g3
	addcc %o0,%g2,%g2
	addx %g0,%g3,%o0
	deccc 4,%g1
	bnz LOCAL(mp32setmul_loop)
	st %g2,[%o1+%g1]
	retl
	nop
C_FUNCTION_END(mp32setmul, LOCAL(mp32setmul_size))


C_FUNCTION_BEGIN(mp32addmul)
LABEL(mp32addmul)

	.register %g2,#scratch

	sll %o0,2,%g1
	mov %o1,%o4
	dec 4,%o1
	dec 4,%o2
	clr %o0
LOCAL(mp32addmul_loop):
	ld [%o2+%g1],%g2
	ld [%o1+%g1],%g3
	umul %o3,%g2,%g2
	rd %y,%g4
	addcc %o0,%g2,%g2
	addx %g0,%g4,%g4
	addcc %g2,%g3,%g2
	addx %g0,%g4,%o0
	deccc 4,%g1
	bnz LOCAL(mp32addmul_loop)
	st %g2,[%o4+%g1]
	retl
	nop
C_FUNCTION_END(mp32addmul, LOCAL(mp32addmul_size))


C_FUNCTION_BEGIN(mp32addsqrtrc)
LABEL(mp32addsqrtrc)

        .register %g2,#scratch
        .register %g3,#scratch

        sll %o0,2,%g1
        add %o1,%g1,%o1
		dec 4,%o2
        add %o1,%g1,%o1
		dec 8,%o1
        clr %o0
LOCAL(mp32addsqrtrc_loop):
        ld [%o2+%g1],%g2
        ldd [%o1],%o4
        umul %g2,%g2,%g3
        rd %y,%g2
		/* first addition */
        addcc %o5,%g3,%o5
        addxcc %o4,%g2,%o4
        addx %g0,%g0,%o3
		/* second addition */
        addcc %o5,%o0,%o5
        addxcc %o4,%g0,%o4
        addx %o3,%g0,%o0
        std %o4,[%o1]
        deccc 4,%g1
        bnz LOCAL(mp32addsqrtrc_loop)
        sub %o1,8,%o1
        retl
        nop
C_FUNCTION_END(mp32addsqrtrc, LOCAL(mp32addsqrtrc_size))