Debian Codegraph @

mpn/powerpc64/mode64/p7/gcd_11.asm

raw
1 dnl PowerPC-64 mpn_gcd_11.
2
3 dnl Copyright 2000-2002, 2005, 2009, 2011-2013 Free Software Foundation, Inc.
4
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
10 dnl * the GNU Lesser General Public License as published by the Free
11 dnl Software Foundation; either version 3 of the License, or (at your
12 dnl option) any later version.
13 dnl
14 dnl or
15 dnl
16 dnl * the GNU General Public License as published by the Free Software
17 dnl Foundation; either version 2 of the License, or (at your option) any
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
22 dnl The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 dnl for more details.
26 dnl
27 dnl You should have received copies of the GNU General Public License and the
28 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
29 dnl see https://www.gnu.org/licenses/.
30
31 include(`../config.m4')
32
33 C cycles/bit (approx)
34 C POWER3/PPC630 -
35 C POWER4/PPC970 -
36 C POWER5 -
37 C POWER6 -
38 C POWER7 7.6 obsolete
39 C POWER8 ?
40 C POWER9 ?
41 C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
42
43 C INPUT PARAMETERS
44 define(`u0', `r3')
45 define(`v0', `r4')
46
47 define(`cnt', `r9')dnl
48
49 ASM_START()
50 PROLOGUE(mpn_gcd_11)
51 li r12, 63
52 b L(odd)
53
54 ALIGN(16)
55 L(top): and r8, r11, r10 C isolate lsb
56 cntlzd cnt, r8
57 isel v0, u0, v0, 29 C v = min(u,v)
58 isel u0, r10, r11, 29 C u = |u - v|
59 subf cnt, cnt, r12 C cnt = 63-cnt
60 srd u0, u0, cnt
61 L(odd): cmpld cr7, v0, u0
62 subf r10, u0, v0 C r10 = v - u
63 subf r11, v0, u0 C r11 = u - v
64 bne cr7, L(top)
65
66 L(end): blr
67 EPILOGUE()