beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / sparc64 / ultrasparct3 / invert_limb.asm
blob4da49cf030128d0b06dbe90be8105b522a0a639a
1 dnl SPARC T3/T4/T5 mpn_invert_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 UltraSPARC T3: ?
37 C UltraSPARC T4/T5: ?
39 C INPUT PARAMETERS
40 define(`d', `%o0')
42 ASM_START()
43 REGISTER(%g2,#scratch)
44 REGISTER(%g3,#scratch)
45 PROLOGUE(mpn_invert_limb)
46 srlx d, 54, %g1
47 LEA64(approx_tab, g2, g3)
48 and %g1, 0x1fe, %g1
49 srlx d, 24, %g4
50 lduh [%g2+%g1], %g3
51 add %g4, 1, %g4
52 sllx %g3, 11, %g2
53 add %g2, -1, %g2
54 mulx %g3, %g3, %g3
55 mulx %g3, %g4, %g3
56 srlx %g3, 40, %g3
57 sub %g2, %g3, %g2
58 sllx %g2, 60, %g1
59 mulx %g2, %g2, %g3
60 mulx %g3, %g4, %g4
61 sub %g1, %g4, %g1
62 srlx %g1, 47, %g1
63 sllx %g2, 13, %g2
64 add %g1, %g2, %g1
65 and d, 1, %g2
66 srlx %g1, 1, %g4
67 sub %g0, %g2, %g3
68 and %g4, %g3, %g3
69 srlx d, 1, %g4
70 add %g4, %g2, %g2
71 mulx %g1, %g2, %g2
72 sub %g3, %g2, %g2
73 umulxhi(%g1, %g2, %g2)
74 srlx %g2, 1, %g2
75 sllx %g1, 31, %g1
76 add %g2, %g1, %g1
77 mulx %g1, d, %g3
78 umulxhi(d, %g1, %g4)
79 addcc %g3, d, %g0
80 addxc( %g4, d, %o0)
81 jmp %o7+8
82 sub %g1, %o0, %o0
83 EPILOGUE()
85 RODATA
86 ALIGN(2)
87 TYPE( approx_tab, object)
88 SIZE( approx_tab, 512)
89 approx_tab:
90 forloop(i,256,512-1,dnl
91 ` .half eval(0x7fd00/i)
92 ')dnl