[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Mon Feb 20 20:24:09 CET 2012


details:   /var/hg/gmp/rev/75bb8485f3e8
changeset: 14653:75bb8485f3e8
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Feb 20 20:21:42 2012 +0100
description:
Fix some DOS64 issues (but disable DOS64 support until tested).

details:   /var/hg/gmp/rev/7adc52fd8104
changeset: 14654:7adc52fd8104
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Feb 20 20:22:53 2012 +0100
description:
Add SBR mul_1 file.

details:   /var/hg/gmp/rev/9cb9176f4779
changeset: 14655:9cb9176f4779
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Feb 20 20:23:57 2012 +0100
description:
Trivial merge.

diffstat:

 ChangeLog                           |   11 ++
 mpn/generic/toom_interpolate_8pts.c |    8 +-
 mpn/x86_64/coreisbr/aorsmul_1.asm   |   22 ++--
 mpn/x86_64/coreisbr/mul_1.asm       |  142 ++++++++++++++++++++++++++++++++++++
 mpz/and.c                           |  105 ++++++++-----------------
 mpz/gcdext.c                        |   56 +++++++-------
 6 files changed, 231 insertions(+), 113 deletions(-)

diffs (truncated from 585 to 300 lines):

diff -r cfc4a1f99a29 -r 9cb9176f4779 ChangeLog
--- a/ChangeLog	Mon Feb 20 19:03:33 2012 +0100
+++ b/ChangeLog	Mon Feb 20 20:23:57 2012 +0100
@@ -1,5 +1,15 @@
+2012-02-20 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/toom_interpolate_8pts.c: Compute carry iif non-trivial.
+
+	* mpz/gcdext.c: Adapt to relaxed mpn_gcdext's input requirements.
+
+	* mpz/and.c: Use mpn_ logic everywhere. Reduce branches.
+
 2012-02-20  Torbjorn Granlund  <tege at gmplib.org>
 
+	* mpn/x86_64/coreisbr/mul_1.asm: New file.
+
 	* mpn/x86_64/coreisbr/aorsmul_1.asm: New file.
 
 2012-02-19  Torbjorn Granlund  <tege at gmplib.org>
@@ -21,6 +31,7 @@
 	* mpn/generic/powm_sec.c (MPN_REDC_1_SEC): Likewise.
 	* mpn/generic/powm.c (MPN_REDC_2): New macro, use for mpn_redc_2.
 
+>>>>>>> other
 2012-02-18  Marc Glisse  <marc.glisse at inria.fr>
 
 	* gmpxx.h (std::common_type): New partial specialization in C++11.
diff -r cfc4a1f99a29 -r 9cb9176f4779 mpn/generic/toom_interpolate_8pts.c
--- a/mpn/generic/toom_interpolate_8pts.c	Mon Feb 20 19:03:33 2012 +0100
+++ b/mpn/generic/toom_interpolate_8pts.c	Mon Feb 20 20:23:57 2012 +0100
@@ -6,7 +6,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2009, 2011 Free Software Foundation, Inc.
+Copyright 2009, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -193,9 +193,9 @@
 
   cy = mpn_add_1 (pp + 6*n, r3 + n, n, pp[6*n]);
   MPN_INCR_U (r3 + 2*n, n + 1, cy);
-  cy = r3[3*n] + mpn_add_n (pp + 7*n, pp + 7*n, r3 + 2*n, n);
+  cy = mpn_add_n (pp + 7*n, pp + 7*n, r3 + 2*n, n);
   if (LIKELY(spt != n))
-    MPN_INCR_U (pp + 8*n, spt - n, cy);
+    MPN_INCR_U (pp + 8*n, spt - n, cy + r3[3*n]);
   else
-    ASSERT (cy == 0);
+    ASSERT (r3[3*n] | cy == 0);
 }
diff -r cfc4a1f99a29 -r 9cb9176f4779 mpn/x86_64/coreisbr/aorsmul_1.asm
--- a/mpn/x86_64/coreisbr/aorsmul_1.asm	Mon Feb 20 19:03:33 2012 +0100
+++ b/mpn/x86_64/coreisbr/aorsmul_1.asm	Mon Feb 20 20:23:57 2012 +0100
@@ -41,7 +41,7 @@
 define(`rp',      `%rdi')   C rcx
 define(`up',      `%rsi')   C rdx
 define(`n_param', `%rdx')   C r8
-define(`vl',      `%rcx')   C r9
+define(`v0',      `%rcx')   C r9
 
 define(`n',	  `%rbx')
 
@@ -54,14 +54,14 @@
       define(`func',  `mpn_submul_1')
 ')
 
-ABI_SUPPORT(DOS64)
+dnl Disable until tested ABI_SUPPORT(DOS64)
 ABI_SUPPORT(STD64)
 
 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
 
 IFDOS(`	define(`up', ``%rsi'')	') dnl
 IFDOS(`	define(`rp', ``%rcx'')	') dnl
-IFDOS(`	define(`vl', ``%r9'')	') dnl
+IFDOS(`	define(`v0', ``%r9'')	') dnl
 IFDOS(`	define(`r9', ``rdi'')	') dnl
 IFDOS(`	define(`n',  ``%r8'')	') dnl
 IFDOS(`	define(`r8', ``r11'')	') dnl
@@ -100,7 +100,7 @@
 	lea	-8(rp,n,8), rp
 	neg	n
 	add	$1, n
-	mul	%rcx
+	mul	v0
 	ADDSUB	%rax, %r10
 	mov	8(up,n,8), %rax
 	mov	%rdx, %r11
@@ -111,7 +111,7 @@
 	lea	-8(rp,n,8), rp
 	neg	n
 	add	$2, n
-	mul	%rcx
+	mul	v0
 	mov	%rdx, %r9
 	mov	$0, R32(%r11)
 	jmp	L(L3)
@@ -120,7 +120,7 @@
 	lea	-8(rp,n,8), rp
 	neg	n
 	add	$3, n
-	mul	%rcx
+	mul	v0
 	ADDSUB	%rax, %r10
 	mov	%rdx, %r11
 	mov	-8(up,n,8), %rax
@@ -129,7 +129,7 @@
 	jmp	L(L0)
 
 	ALIGN(16)
-L(top):	mul	%rcx
+L(top):	mul	v0
 	ADDSUB	%rax, %r8
 	mov	%rdx, %r9
 	adc	$0, %r9
@@ -137,13 +137,13 @@
 	ADDSUB	%r11, %r8
 	mov	-16(rp,n,8), %r10
 	adc	$0, %r9
-	mul	%rcx
+	mul	v0
 	ADDSUB	%rax, %r10
 	mov	%rdx, %r11
 	mov	-8(up,n,8), %rax
 	adc	$0, %r11
 	mov	%r8, -24(rp,n,8)
-L(L0):	mul	%rcx
+L(L0):	mul	v0
 	ADDSUB	%r9, %r10
 	mov	-8(rp,n,8), %r8
 	adc	$0, %r11
@@ -155,7 +155,7 @@
 	ADDSUB	%r11, %r8
 	adc	$0, %r9
 	mov	(rp,n,8), %r10
-	mul	%rcx
+	mul	v0
 	ADDSUB	%rax, %r10
 	mov	8(up,n,8), %rax
 	mov	%rdx, %r11
@@ -168,7 +168,7 @@
 	add	$4, n 
 	jnc	L(top)
 
-L(end):	mul	%rcx
+L(end):	mul	v0
 	ADDSUB	%rax, %r8
 	mov	%rdx, %rax
 	adc	$0, %rax
diff -r cfc4a1f99a29 -r 9cb9176f4779 mpn/x86_64/coreisbr/mul_1.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86_64/coreisbr/mul_1.asm	Mon Feb 20 20:23:57 2012 +0100
@@ -0,0 +1,142 @@
+dnl  X86-64 mpn_mul_1 optimised for Intel Sandy Bridge.
+
+dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
+dnl  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 AMD K8,K9	 
+C AMD K10	 
+C AMD bd1	 
+C AMD bobcat	 
+C Intel P4	 
+C Intel core2	 
+C Intel NHM	 
+C Intel SBR	 
+C Intel atom	 
+C VIA nano	 
+
+C The loop of this code is the result of running a code generation and
+C optimisation tool suite written by David Harvey and Torbjorn Granlund.
+
+C TODO
+C  * The loop is great, but the prologue code was quickly written.  Tune it!
+C  * Add mul_1c entry point.
+
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+define(`v0',      `%rcx')   C r9
+
+define(`n',	  `%r11')
+
+dnl Disable until tested ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+IFDOS(`	define(`up', ``%rsi'')	') dnl
+IFDOS(`	define(`rp', ``%rcx'')	') dnl
+IFDOS(`	define(`v0', ``%r9'')	') dnl
+IFDOS(`	define(`r9', ``rdi'')	') dnl
+IFDOS(`	define(`n',  ``%r8'')	') dnl
+IFDOS(`	define(`r8', ``r11'')	') dnl
+
+ASM_START()
+	TEXT
+	ALIGN(16)
+
+PROLOGUE(mpn_mul_1)
+IFDOS(``push	%rsi		'')
+IFDOS(``push	%rdi		'')
+IFDOS(``mov	%rdx, %rsi	'')
+
+	mov	(up), %rax
+IFSTD(`	mov	R32(n_param), R32(%r10) ')
+IFDOS(`	mov	R32(n), R32(%r10)       ')
+IFSTD(`	mov	R32(n_param), R32(n)    ')
+
+	lea	(up,n_param,8), up
+	lea	-8(rp,n_param,8), rp
+	neg	n
+	mul	v0
+	and	$3, R32(%r10)
+	jz	L(b0)
+	cmp	$2, R32(%r10)
+	jb	L(b1)
+	jz	L(b2)
+
+L(b3):	add	$-1, n
+	mov	%rax, %r9
+	mov	%rdx, %r8
+	mov	16(up,n,8), %rax
+	jmp	L(L3)
+
+L(b1):	mov	%rax, %r9
+	mov	%rdx, %r8
+	add	$1, n
+	jnc	L(L1)
+	mov	%rax, (rp)
+	mov	%rdx, %rax
+	ret
+
+L(b2):	add	$-2, n
+	mov	%rax, %r8
+	mov	%rdx, %r9
+	mov	24(up,n,8), %rax
+	jmp	L(L2)
+
+L(b0):	mov	%rax, %r8
+	mov	%rdx, %r9
+	mov	8(up,n,8), %rax
+	jmp	L(L0)
+
+	ALIGN(8)
+L(top):	mov	%rdx, %r8
+	add	%rax, %r9
+L(L1):	mov	0(up,n,8), %rax
+	adc	$0, %r8
+	mul	v0
+	add	%rax, %r8
+	mov	%r9, 0(rp,n,8)
+	mov	8(up,n,8), %rax
+	mov	%rdx, %r9
+	adc	$0, %r9
+L(L0):	mul	v0
+	mov	%r8, 8(rp,n,8)
+	add	%rax, %r9
+	mov	%rdx, %r8
+	mov	16(up,n,8), %rax
+	adc	$0, %r8
+L(L3):	mul	v0
+	mov	%r9, 16(rp,n,8)
+	mov	%rdx, %r9
+	add	%rax, %r8
+	mov	24(up,n,8), %rax
+	adc	$0, %r9
+L(L2):	mul	v0
+	mov	%r8, 24(rp,n,8)
+	add	$4, n
+	jnc	L(top)
+
+L(end):	add	%rax, %r9
+	mov	%rdx, %rax
+	adc	$0, %rax
+	mov	%r9, (rp)
+
+	ret
+EPILOGUE()
diff -r cfc4a1f99a29 -r 9cb9176f4779 mpz/and.c
--- a/mpz/and.c	Mon Feb 20 19:03:33 2012 +0100
+++ b/mpz/and.c	Mon Feb 20 20:23:57 2012 +0100


More information about the gmp-commit mailing list