summaryrefslogtreecommitdiff
path: root/mpi/alpha/mpih-sub1.S
blob: bf614309b7a27767cda07bf3cf7244779d0bf52b (plain)
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
115
116
117
118
119
120
121
122
123
/* Alpha  sub_n -- Subtract two limb vectors of the same length > 0 and
 *		  store difference in a third limb vector.
 * Copyright (C) 1995, 1998 Free Software Foundation, Inc.
 *
 * This file is part of GNUPG.
 *
 * GNUPG is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GNUPG 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */


/*******************
 *  mpi_limb_t
 *  mpihelp_sub_n( mpi_ptr_t res_ptr,	(r16)
 *		   mpi_ptr_t s1_ptr,	(r17)
 *		   mpi_ptr_t s2_ptr,	(r18)
 *		   mpi_size_t size)	(r19)
 */

	.set	noreorder
	.set	noat
.text
	.align	3
	.globl	mpihelp_sub_n
	.ent	mpihelp_sub_n
mpihelp_sub_n:
	.frame	$30,0,$26,0

	ldq	$3,0($17)
	ldq	$4,0($18)

	subq	$19,1,$19
	and	$19,4-1,$2	# number of limbs in first loop
	bis	$31,$31,$0
	beq	$2,.L0		# if multiple of 4 limbs, skip first loop

	subq	$19,$2,$19

.Loop0: subq	$2,1,$2
	ldq	$5,8($17)
	addq	$4,$0,$4
	ldq	$6,8($18)
	cmpult	$4,$0,$1
	subq	$3,$4,$4
	cmpult	$3,$4,$0
	stq	$4,0($16)
	or	$0,$1,$0

	addq	$17,8,$17
	addq	$18,8,$18
	bis	$5,$5,$3
	bis	$6,$6,$4
	addq	$16,8,$16
	bne	$2,.Loop0

.L0:	beq	$19,.Lend

	.align	3
.Loop:	subq	$19,4,$19

	ldq	$5,8($17)
	addq	$4,$0,$4
	ldq	$6,8($18)
	cmpult	$4,$0,$1
	subq	$3,$4,$4
	cmpult	$3,$4,$0
	stq	$4,0($16)
	or	$0,$1,$0

	ldq	$3,16($17)
	addq	$6,$0,$6
	ldq	$4,16($18)
	cmpult	$6,$0,$1
	subq	$5,$6,$6
	cmpult	$5,$6,$0
	stq	$6,8($16)
	or	$0,$1,$0

	ldq	$5,24($17)
	addq	$4,$0,$4
	ldq	$6,24($18)
	cmpult	$4,$0,$1
	subq	$3,$4,$4
	cmpult	$3,$4,$0
	stq	$4,16($16)
	or	$0,$1,$0

	ldq	$3,32($17)
	addq	$6,$0,$6
	ldq	$4,32($18)
	cmpult	$6,$0,$1
	subq	$5,$6,$6
	cmpult	$5,$6,$0
	stq	$6,24($16)
	or	$0,$1,$0

	addq	$17,32,$17
	addq	$18,32,$18
	addq	$16,32,$16
	bne	$19,.Loop

.Lend:	addq	$4,$0,$4
	cmpult	$4,$0,$1
	subq	$3,$4,$4
	cmpult	$3,$4,$0
	stq	$4,0($16)
	or	$0,$1,$0
	ret	$31,($26),1

	.end	mpihelp_sub_n