beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm64 / invert_limb.asm
bloba94b0e961188a85089ed308cfc69c731f50a2292
1 dnl ARM64 mpn_invert_limb -- Invert a normalized limb.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright 2013 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
15 dnl
16 dnl or
17 dnl
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 dnl for more details.
28 dnl
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
33 include(`../config.m4')
35 C cycles/limb
36 C Cortex-A53 ?
37 C Cortex-A57 ?
39 C Compiler generated, mildly edited. Could surely be further optimised.
41 ASM_START()
42 PROLOGUE(mpn_invert_limb)
43 lsr x2, x0, #54
44 adrp x1, approx_tab
45 and x2, x2, #0x1fe
46 add x1, x1, :lo12:approx_tab
47 ldrh w3, [x1,x2]
48 lsr x4, x0, #24
49 add x4, x4, #1
50 ubfiz x2, x3, #11, #16
51 umull x3, w3, w3
52 mul x3, x3, x4
53 sub x2, x2, #1
54 sub x2, x2, x3, lsr #40
55 lsl x3, x2, #60
56 mul x1, x2, x2
57 msub x1, x1, x4, x3
58 lsl x2, x2, #13
59 add x1, x2, x1, lsr #47
60 and x2, x0, #1
61 neg x3, x2
62 and x3, x3, x1, lsr #1
63 add x2, x2, x0, lsr #1
64 msub x2, x1, x2, x3
65 umulh x2, x2, x1
66 lsl x1, x1, #31
67 add x1, x1, x2, lsr #1
68 mul x3, x1, x0
69 umulh x2, x1, x0
70 adds x4, x3, x0
71 adc x0, x2, x0
72 sub x0, x1, x0
73 ret
74 EPILOGUE()
76 RODATA
77 ALIGN(2)
78 TYPE( approx_tab, object)
79 SIZE( approx_tab, 512)
80 approx_tab:
81 forloop(i,256,512-1,dnl
82 ` .hword eval(0x7fd00/i)
83 ')dnl