1dnl  ARM v8a mpn_gcd_11.
2
3dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for ARM by Torbjorn
4dnl  Granlund.
5
6dnl  Copyright 2000-2002, 2005, 2009, 2011-2013 Free Software Foundation, Inc.
7
8dnl  This file is part of the GNU MP Library.
9dnl
10dnl  The GNU MP Library is free software; you can redistribute it and/or modify
11dnl  it under the terms of either:
12dnl
13dnl    * the GNU Lesser General Public License as published by the Free
14dnl      Software Foundation; either version 3 of the License, or (at your
15dnl      option) any later version.
16dnl
17dnl  or
18dnl
19dnl    * the GNU General Public License as published by the Free Software
20dnl      Foundation; either version 2 of the License, or (at your option) any
21dnl      later version.
22dnl
23dnl  or both in parallel, as here.
24dnl
25dnl  The GNU MP Library is distributed in the hope that it will be useful, but
26dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28dnl  for more details.
29dnl
30dnl  You should have received copies of the GNU General Public License and the
31dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
32dnl  see https://www.gnu.org/licenses/.
33
34include(`../config.m4')
35
36changecom(blah)
37
38C	     cycles/bit (approx)
39C Cortex-A35	 ?
40C Cortex-A53	 ?
41C Cortex-A55	 ?
42C Cortex-A57	 ?
43C Cortex-A72	 ?
44C Cortex-A73	 ?
45C Cortex-A75	 ?
46C Cortex-A76	 ?
47C Cortex-A77	 ?
48C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
49
50define(`u0',    `x0')
51define(`v0',    `x1')
52
53ASM_START()
54	TEXT
55	ALIGN(16)
56PROLOGUE(mpn_gcd_11)
57	subs	x3, u0, v0		C			0
58	b.eq	L(end)			C
59
60	ALIGN(16)
61L(top):	rbit	x12, x3			C			1,5
62	clz	x12, x12		C			2
63	csneg	x3, x3, x3, cs		C v = abs(u-v), even	1
64	csel	u0, v0, u0, cs		C u = min(u,v)		1
65	lsr	v0, x3, x12		C			3
66	subs	x3, u0, v0		C			4
67	b.ne	L(top)			C
68
69L(end):	ret
70EPILOGUE()
71