about summary refs log tree commit diff
path: root/sysdeps/sparc/sparc32/sparcv9/submul_1.S
blob: 9c89feb5d990cc3936549716dcc836925882a4c5 (plain) (blame)
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
! SPARC v9 32-bit mpn_submul_1.
!
! Copyright 2010-2013 Free Software Foundation, Inc.
!
! This file is part of the GNU MP Library.
!
! The GNU MP 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 3 of the License, or (at
! your option) any later version.

! The GNU MP 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 the GNU MP Library.  If not, see http://www.gnu.org/licenses/.

! INPUT PARAMETERS
! res_ptr	%i0
! s1_ptr	%i1
! size		%i2
! s2_limb	%i3

#include <sysdep.h>

ENTRY(__mpn_submul_1)
	save	%sp, -96, %sp
	srl	%i2, 0, %o4
	srl	%i3, 0, %g1
	subcc	%o4, 1, %o4
	be	.Lfinal_one
	 subcc	%g0, 0, %o5

.Ltop:
	lduw	[%i1+0], %l0
	lduw	[%i0+0], %l2
	lduw	[%i1+4], %l1
	lduw	[%i0+4], %l3
	mulx	%l0, %g1, %g3
	add	%i1, 8, %i1
	mulx	%l1, %g1, %o3
	sub	%o4, 2, %o4
	add	%i0, 8, %i0
	addx	%o5, %g3, %g3
	srlx	%g3, 32, %o5
	subcc	%l2, %g3, %g3
	stw	%g3, [%i0-8]
	addx	%o5, %o3, %o3
	srlx	%o3, 32, %o5
	subcc	%l3, %o3, %o3
	brgz	%o4, .Ltop
	 stw	%o3, [%i0-4]

	brlz,pt	%o4, .Ldone
	 nop

.Lfinal_one:
	lduw	[%i1+0], %l0
	lduw	[%i0+0], %l2
	mulx	%l0, %g1, %g3
	addx	%o5, %g3, %g3
	srlx	%g3, 32, %o5
	subcc	%l2, %g3, %g3
	stw	%g3, [%i0+0]

.Ldone:
	addx	%o5, 0, %o5
	jmpl	%i7 + 8, %g0
	 restore %o5, 0, %o0
END(__mpn_submul_1)