1dnl  ARM v6t2 mpn_gcd_11.
2
3dnl  Copyright 2000-2002, 2005, 2009, 2011, 2012, 2019 Free Software Foundation,
4dnl  Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32include(`../config.m4')
33
34C	     cycles/bit (approx)
35C StrongARM	 -
36C XScale	 -
37C Cortex-A5	 5.2
38C Cortex-A7	 5.04
39C Cortex-A8	 3.59
40C Cortex-A9	 9.5
41C Cortex-A15	 3.2
42C Cortex-A17	 5.25
43C Cortex-A53	 3.57
44
45define(`u0',    `r0')
46define(`v0',    `r1')
47
48ASM_START()
49	TEXT
50	ALIGN(64)
51PROLOGUE(mpn_gcd_11)
52	subs	r3, u0, v0	C			0
53	beq	L(end)		C
54
55	ALIGN(16)
56L(top):	rbit	r12, r3		C			1,5
57	clz	r12, r12	C			2
58	rsbcc	r3, r3, #0	C v = abs(u-v), even	1
59	movcs	u0, v0		C u = min(u,v)		1
60	lsr	v0, r3, r12	C			3
61	subs	r3, u0, v0	C			4
62	bne	L(top)		C
63
64L(end):	bx	lr
65EPILOGUE()
66