[Gmp-commit] /var/hg/gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Wed Apr 17 17:06:02 CEST 2013
details: /var/hg/gmp/rev/233a090d640f
changeset: 15733:233a090d640f
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed Apr 17 17:04:54 2013 +0200
description:
(arm64 count_trailing_zeros): New.
details: /var/hg/gmp/rev/feca99cc7d06
changeset: 15734:feca99cc7d06
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed Apr 17 17:05:39 2013 +0200
description:
ARM64 invert_limb.
details: /var/hg/gmp/rev/3d08c3752df9
changeset: 15735:3d08c3752df9
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed Apr 17 17:05:56 2013 +0200
description:
ChangeLog
diffstat:
ChangeLog | 4 ++
longlong.h | 2 +
mpn/arm64/invert_limb.asm | 72 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 0 deletions(-)
diffs (101 lines):
diff -r 6a00316342da -r 3d08c3752df9 ChangeLog
--- a/ChangeLog Wed Apr 17 14:43:51 2013 +0200
+++ b/ChangeLog Wed Apr 17 17:05:56 2013 +0200
@@ -1,5 +1,9 @@
2013-04-17 Torbjorn Granlund <tege at gmplib.org>
+ * longlong.h (arm64 count_trailing_zeros): New.
+
+ * mpn/arm64/invert_limb.asm: New file.
+
* mpn/generic/dive_1.c: Rewrite to use Hensel division also for
size = 1.
diff -r 6a00316342da -r 3d08c3752df9 longlong.h
--- a/longlong.h Wed Apr 17 14:43:51 2013 +0200
+++ b/longlong.h Wed Apr 17 17:05:56 2013 +0200
@@ -548,6 +548,8 @@
} while (0)
#define count_leading_zeros(count, x) \
__asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
+#define count_trailing_zeros(count, x) \
+ __asm__ ("rbit\t%0, %1\n\tclz\t%0, %0" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 64
#endif /* __aarch64__ */
diff -r 6a00316342da -r 3d08c3752df9 mpn/arm64/invert_limb.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/arm64/invert_limb.asm Wed Apr 17 17:05:56 2013 +0200
@@ -0,0 +1,72 @@
+dnl ARM64 mpn_invert_limb -- Invert a normalized limb.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2013 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+dnl The GNU MP Library is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C cycles/limb
+C Cortex-A53 ?
+C Cortex-A57 ?
+
+C Compiler generated, mildly edited. Could surely be further optimised.
+
+ASM_START()
+PROLOGUE(mpn_invert_limb)
+ lsr x2, x0, 54
+ adrp x1, approx_tab
+ and x2, x2, #0x1fe
+ add x1, x1, :lo12:approx_tab
+ ldrh w3, [x1,x2]
+ lsr x4, x0, 24
+ add x4, x4, 1
+ ubfiz x2, x3, 11, 16
+ umull x3, w3, w3
+ mul x3, x3, x4
+ sub x2, x2, #1
+ sub x2, x2, x3, lsr 40
+ lsl x3, x2, 60
+ mul x1, x2, x2
+ msub x1, x1, x4, x3
+ lsl x2, x2, 13
+ add x1, x2, x1, lsr 47
+ and x2, x0, 1
+ neg x3, x2
+ and x3, x3, x1, lsr 1
+ add x2, x2, x0, lsr 1
+ msub x2, x1, x2, x3
+ umulh x2, x2, x1
+ lsl x1, x1, 31
+ add x1, x1, x2, lsr 1
+ mul x3, x1, x0
+ umulh x2, x1, x0
+ adds x4, x3, x0
+ adc x0, x2, x0
+ sub x0, x1, x0
+ ret
+EPILOGUE()
+
+ RODATA
+ ALIGN(2)
+ TYPE( approx_tab, object)
+ SIZE( approx_tab, 512)
+approx_tab:
+forloop(i,256,512-1,dnl
+` .hword eval(0x7fd00/i)
+')dnl
More information about the gmp-commit
mailing list