1dnl  SPARC T1 32-bit mpn_submul_1.
2
3dnl  Contributed to the GNU project by David Miller.
4
5dnl  Copyright 2010, 2013 Free Software Foundation, Inc.
6
7dnl  This file is part of the GNU MP Library.
8dnl
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of either:
11dnl
12dnl    * the GNU Lesser General Public License as published by the Free
13dnl      Software Foundation; either version 3 of the License, or (at your
14dnl      option) any later version.
15dnl
16dnl  or
17dnl
18dnl    * the GNU General Public License as published by the Free Software
19dnl      Foundation; either version 2 of the License, or (at your option) any
20dnl      later version.
21dnl
22dnl  or both in parallel, as here.
23dnl
24dnl  The GNU MP Library is distributed in the hope that it will be useful, but
25dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27dnl  for more details.
28dnl
29dnl  You should have received copies of the GNU General Public License and the
30dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
31dnl  see https://www.gnu.org/licenses/.
32
33include(`../config.m4')
34
35C		   cycles/limb
36C UltraSPARC T1:       24
37C UltraSPARC T2:       19
38C UltraSPARC T3:       19
39C UltraSPARC T4:       5
40
41C INPUT PARAMETERS
42define(`rp',	`%i0')
43define(`up',	`%i1')
44define(`n',	`%i2')
45define(`v0',	`%i3')
46
47ASM_START()
48PROLOGUE(mpn_submul_1)
49	save	%sp, -96, %sp
50	srl	n, 0, %o4
51	srl	v0, 0, %g1
52	subcc	%o4, 1, %o4
53	be	L(final_one)
54	 subcc	%g0, 0, %o5
55
56L(top):	lduw	[up+0], %l0
57	lduw	[rp+0], %l2
58	lduw	[up+4], %l1
59	lduw	[rp+4], %l3
60	mulx	%l0, %g1, %g3
61	add	up, 8, up
62	mulx	%l1, %g1, %o3
63	sub	%o4, 2, %o4
64	add	rp, 8, rp
65	addx	%o5, %g3, %g3
66	srlx	%g3, 32, %o5
67	subcc	%l2, %g3, %g3
68	stw	%g3, [rp-8]
69	addx	%o5, %o3, %o3
70	srlx	%o3, 32, %o5
71	subcc	%l3, %o3, %o3
72	brgz	%o4, L(top)
73	 stw	%o3, [rp-4]
74
75	brlz,pt	%o4, L(done)
76	 nop
77
78L(final_one):
79	lduw	[up+0], %l0
80	lduw	[rp+0], %l2
81	mulx	%l0, %g1, %g3
82	addx	%o5, %g3, %g3
83	srlx	%g3, 32, %o5
84	subcc	%l2, %g3, %g3
85	stw	%g3, [rp+0]
86
87L(done):
88	addx	%o5, 0, %o5
89	ret
90	 restore %o5, 0, %o0
91EPILOGUE()
92