• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/libgcrypt-1.5.1/mpi/alpha/
1/* alpha  add_n -- Add two limb vectors of the same length > 0 and store
2 *		   sum in a third limb vector.
3 * Copyright (C) 1995, 1998, 2001, 2002 Free Software Foundation, Inc.
4 *
5 * This file is part of Libgcrypt.
6 *
7 * Libgcrypt is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * Libgcrypt is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 */
21
22
23
24/*******************
25 *  mpi_limb_t
26 *  _gcry_mpih_add_n( mpi_ptr_t res_ptr,	($16)
27 *		   mpi_ptr_t s1_ptr,	($17)
28 *		   mpi_ptr_t s2_ptr,	($18)
29 *		   mpi_size_t size)	($19)
30 */
31
32
33	.set	noreorder
34	.set	noat
35.text
36	.align	3
37	.globl	_gcry_mpih_add_n
38	.ent	_gcry_mpih_add_n
39_gcry_mpih_add_n:
40	.frame	$30,0,$26,0
41
42	ldq	$3,0($17)
43	ldq	$4,0($18)
44
45	subq	$19,1,$19
46	and	$19,4-1,$2	# number of limbs in first loop
47	bis	$31,$31,$0
48	beq	$2,.L0		# if multiple of 4 limbs, skip first loop
49
50	subq	$19,$2,$19
51
52.Loop0: subq	$2,1,$2
53	ldq	$5,8($17)
54	addq	$4,$0,$4
55	ldq	$6,8($18)
56	cmpult	$4,$0,$1
57	addq	$3,$4,$4
58	cmpult	$4,$3,$0
59	stq	$4,0($16)
60	or	$0,$1,$0
61
62	addq	$17,8,$17
63	addq	$18,8,$18
64	bis	$5,$5,$3
65	bis	$6,$6,$4
66	addq	$16,8,$16
67	bne	$2,.Loop0
68
69.L0:	beq	$19,.Lend
70
71	.align	3
72.Loop:	subq	$19,4,$19
73
74	ldq	$5,8($17)
75	addq	$4,$0,$4
76	ldq	$6,8($18)
77	cmpult	$4,$0,$1
78	addq	$3,$4,$4
79	cmpult	$4,$3,$0
80	stq	$4,0($16)
81	or	$0,$1,$0
82
83	ldq	$3,16($17)
84	addq	$6,$0,$6
85	ldq	$4,16($18)
86	cmpult	$6,$0,$1
87	addq	$5,$6,$6
88	cmpult	$6,$5,$0
89	stq	$6,8($16)
90	or	$0,$1,$0
91
92	ldq	$5,24($17)
93	addq	$4,$0,$4
94	ldq	$6,24($18)
95	cmpult	$4,$0,$1
96	addq	$3,$4,$4
97	cmpult	$4,$3,$0
98	stq	$4,16($16)
99	or	$0,$1,$0
100
101	ldq	$3,32($17)
102	addq	$6,$0,$6
103	ldq	$4,32($18)
104	cmpult	$6,$0,$1
105	addq	$5,$6,$6
106	cmpult	$6,$5,$0
107	stq	$6,24($16)
108	or	$0,$1,$0
109
110	addq	$17,32,$17
111	addq	$18,32,$18
112	addq	$16,32,$16
113	bne	$19,.Loop
114
115.Lend:	addq	$4,$0,$4
116	cmpult	$4,$0,$1
117	addq	$3,$4,$4
118	cmpult	$4,$3,$0
119	stq	$4,0($16)
120	or	$0,$1,$0
121	ret	$31,($26),1
122
123	.end	_gcry_mpih_add_n
124
125