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

mercurial at gmplib.org mercurial at gmplib.org
Wed May 31 00:01:13 UTC 2017


details:   /var/hg/gmp/rev/1e8536dba8b2
changeset: 17406:1e8536dba8b2
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed May 31 01:56:13 2017 +0200
description:
Provide optimised logops for recent Intel CPUs.

details:   /var/hg/gmp/rev/1c8a5c4261ed
changeset: 17407:1c8a5c4261ed
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed May 31 01:56:57 2017 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/dfe417dda49c
changeset: 17408:dfe417dda49c
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed May 31 01:58:19 2017 +0200
description:
Use plainer mnemonic variants.

details:   /var/hg/gmp/rev/d5fede059a61
changeset: 17409:d5fede059a61
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed May 31 02:00:44 2017 +0200
description:
Clean up x/l table confusion.

diffstat:

 ChangeLog                     |   24 +++
 mpn/x86_64/core2/hamdist.asm  |   22 +-
 mpn/x86_64/core2/logops_n.asm |  285 ++++++++++++++++++++++++++++++++++++++++++
 mpn/x86_64/core2/popcount.asm |   22 +-
 mpn/x86_64/logops_n.asm       |  212 ++++++++++++++++--------------
 5 files changed, 445 insertions(+), 120 deletions(-)

diffs (truncated from 722 to 300 lines):

diff -r 6db0f711f2a4 -r d5fede059a61 ChangeLog
--- a/ChangeLog	Tue May 30 23:13:47 2017 +0200
+++ b/ChangeLog	Wed May 31 02:00:44 2017 +0200
@@ -1,3 +1,21 @@
+2017-05-31  Torbjörn Granlund  <tg at gmplib.org>
+
+	* mpn/x86_64/core2/logops_n.asm: New file.
+
+2017-05-30  Torbjörn Granlund  <tg at gmplib.org>
+
+	* mpn/x86_64/coreisbr/popcount.asm: Remove.
+
+2017-05-29  Torbjörn Granlund  <tg at gmplib.org>
+
+	* mpn/x86_64/coreinhm/popcount.asm: Replace grabber code with
+	implementation proper.
+	* mpn/x86_64/coreinhm/hamdist.asm: Likewise.
+	* mpn/x86_64/bd1/popcount.asm: Likewise.
+	* mpn/x86_64/bd1/hamdist.asm: Likewise.
+	* mpn/x86_64/core2/popcount.asm: Likewise.
+	* mpn/x86_64/core2/hamdist.asm: New file.
+
 2017-05-22  Torbjörn Granlund  <tg at gmplib.org>
 
 	* mpn/x86_64/core2/com.asm: New grabber file.
@@ -6,6 +24,12 @@
 	* mpn/x86_64/core2/rshift.asm: Rewrite.
 	* mpn/x86_64/core2/lshiftc.asm: Rewrite.
 
+2017-05-16  Torbjörn Granlund  <tg at gmplib.org>
+
+	* mpn/x86_64/zen/mul_1.asm: Port to DOS64.
+	* mpn/x86_64/zen/aorsmul_1.asm: Likewise.
+	* mpn/x86_64/coreibwl/addmul_1.asm: Likewise.
+
 2017-05-16  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/generic/divis.c (mpn_divisible_p): Updated the divisibility
diff -r 6db0f711f2a4 -r d5fede059a61 mpn/x86_64/core2/hamdist.asm
--- a/mpn/x86_64/core2/hamdist.asm	Tue May 30 23:13:47 2017 +0200
+++ b/mpn/x86_64/core2/hamdist.asm	Wed May 31 02:00:44 2017 +0200
@@ -34,23 +34,23 @@
 C		    cycles/limb	  good for cpu?
 C AMD K8,K9		n/a
 C AMD K10		n/a
-C AMD bd1	     1.79-1.91		n
-C AMD bd2	     1.73-1.85		n
+C AMD bd1		 ?
+C AMD bd2		 ?
 C AMD bd3		 ?
 C AMD bd4		 ?
-C AMD zen		 1.47		n
-C AMD bobcat		 8.0		n
-C AMD jaguar		 4.78		n
+C AMD zen		 ?
+C AMD bobcat		 ?
+C AMD jaguar		 ?
 C Intel P4		n/a
-C Intel PNR		 2.61		y
+C Intel PNR		 3.28		y
 C Intel NHM		 ?
 C Intel SBR		 ?
 C Intel IBR		 ?
-C Intel HWL	     1.52-1.58		n
-C Intel BWL	     1.52-1.58		n
-C Intel SKL		 1.51		n
-C Intel atom		12.3		n
-C Intel SLM		 9.1		n
+C Intel HWL		 ?
+C Intel BWL		 ?
+C Intel SKL		 ?
+C Intel atom		 ?
+C Intel SLM		 ?
 C VIA nano		 ?
 
 C TODO
diff -r 6db0f711f2a4 -r d5fede059a61 mpn/x86_64/core2/logops_n.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86_64/core2/logops_n.asm	Wed May 31 02:00:44 2017 +0200
@@ -0,0 +1,285 @@
+dnl  AMD64 logops.
+
+dnl  Copyright 2004-2017 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+dnl
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
+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 General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+
+C		c/l	c/l	c/l	good
+C	       var-1   var-2   var-3  for cpu?
+C AMD K8,K9
+C AMD K10	 1.52	 1.75	 1.75	 n
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD bt1	 2.67	~2.79	~2.79	 =
+C AMD bt2	 2.15	 2.65	 2.65	 n
+C AMD zen	 1.5	 1.5	 1.5	 =
+C Intel P4
+C Intel PNR	 2.0	 2.0	 2.0	 =
+C Intel NHM	 2.0	 2.0	 2.0	 =
+C Intel SBR	 1.5	 1.5	 1.5	 y
+C Intel IBR	 1.47	 1.48	 1.48	 y
+C Intel HWL	 1.11	 1.35	 1.35	 y
+C Intel BWL	 1.09	 1.30	 1.30	 y
+C Intel SKL	 1.21	 1.27	 1.27	 y
+C Intel atom	 3.31	 3.57	 3.57	 y
+C Intel SLM	 3.0	 3.0	 3.0	 =
+C VIA nano
+
+ifdef(`OPERATION_and_n',`
+  define(`func',`mpn_and_n')
+  define(`VARIANT_1')
+  define(`LOGOP',`and')')
+ifdef(`OPERATION_andn_n',`
+  define(`func',`mpn_andn_n')
+  define(`VARIANT_2')
+  define(`LOGOP',`and')')
+ifdef(`OPERATION_nand_n',`
+  define(`func',`mpn_nand_n')
+  define(`VARIANT_3')
+  define(`LOGOP',`and')')
+ifdef(`OPERATION_ior_n',`
+  define(`func',`mpn_ior_n')
+  define(`VARIANT_1')
+  define(`LOGOP',`or')')
+ifdef(`OPERATION_iorn_n',`
+  define(`func',`mpn_iorn_n')
+  define(`VARIANT_2')
+  define(`LOGOP',`or')')
+ifdef(`OPERATION_nior_n',`
+  define(`func',`mpn_nior_n')
+  define(`VARIANT_3')
+  define(`LOGOP',`or')')
+ifdef(`OPERATION_xor_n',`
+  define(`func',`mpn_xor_n')
+  define(`VARIANT_1')
+  define(`LOGOP',`xor')')
+ifdef(`OPERATION_xnor_n',`
+  define(`func',`mpn_xnor_n')
+  define(`VARIANT_2')
+  define(`LOGOP',`xor')')
+
+define(`addptr', `lea	$1($2), $2')
+
+MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`vp',`%rdx')
+define(`n',`%rcx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+
+ifdef(`VARIANT_1',`
+	TEXT
+	ALIGN(32)
+PROLOGUE(func)
+	FUNC_ENTRY(4)
+	mov	(vp), %r8
+	mov	R32(%rcx), R32(%rax)
+	and	$3, R32(%rax)
+	je	L(b00)
+	cmp	$2, R32(%rax)
+	jc	L(b01)
+	je	L(b10)
+
+L(b11):	LOGOP	(up), %r8
+	mov	%r8, (rp)
+	inc	n
+	addptr(	-8, up)
+	addptr(	-8, vp)
+	addptr(	-8, rp)
+	jmp	L(e11)
+L(b10):	add	$2, n
+	addptr(	-16, up)
+	addptr(	-16, vp)
+	addptr(	-16, rp)
+	jmp	L(e10)
+L(b01):	LOGOP	(up), %r8
+	mov	%r8, (rp)
+	dec	n
+	jz	L(ret)
+	addptr(	8, up)
+	addptr(	8, vp)
+	addptr(	8, rp)
+
+	ALIGN(16)
+L(top):	mov	(vp), %r8
+L(b00):	mov	8(vp), %r9
+	LOGOP	(up), %r8
+	LOGOP	8(up), %r9
+	mov	%r8, (rp)
+	mov	%r9, 8(rp)
+L(e11):	mov	16(vp), %r8
+L(e10):	mov	24(vp), %r9
+	addptr(	32, vp)
+	LOGOP	16(up), %r8
+	LOGOP	24(up), %r9
+	addptr(	32, up)
+	mov	%r8, 16(rp)
+	mov	%r9, 24(rp)
+	addptr(	32, rp)
+	sub	$4, n
+	jnz	L(top)
+
+L(ret):	FUNC_EXIT()
+	ret
+EPILOGUE()
+')
+
+ifdef(`VARIANT_2',`
+	TEXT
+	ALIGN(32)
+PROLOGUE(func)
+	FUNC_ENTRY(4)
+	mov	(vp), %r8
+	not	%r8
+	mov	R32(%rcx), R32(%rax)
+	and	$3, R32(%rax)
+	je	L(b00)
+	cmp	$2, R32(%rax)
+	jc	L(b01)
+	je	L(b10)
+
+L(b11):	LOGOP	(up), %r8
+	mov	%r8, (rp)
+	inc	n
+	addptr(	-8, up)
+	addptr(	-8, vp)
+	addptr(	-8, rp)
+	jmp	L(e11)
+L(b10):	add	$2, n
+	addptr(	-16, up)
+	addptr(	-16, vp)
+	addptr(	-16, rp)
+	jmp	L(e10)
+L(b01):	LOGOP	(up), %r8
+	mov	%r8, (rp)
+	dec	n
+	jz	L(ret)
+	addptr(	8, up)
+	addptr(	8, vp)
+	addptr(	8, rp)
+
+	ALIGN(16)
+L(top):	mov	(vp), %r8
+	not	%r8
+L(b00):	mov	8(vp), %r9
+	not	%r9
+	LOGOP	(up), %r8
+	LOGOP	8(up), %r9
+	mov	%r8, (rp)
+	mov	%r9, 8(rp)
+L(e11):	mov	16(vp), %r8
+	not	%r8
+L(e10):	mov	24(vp), %r9
+	not	%r9
+	addptr(	32, vp)
+	LOGOP	16(up), %r8
+	LOGOP	24(up), %r9
+	addptr(	32, up)
+	mov	%r8, 16(rp)
+	mov	%r9, 24(rp)
+	addptr(	32, rp)
+	sub	$4, n
+	jnz	L(top)
+
+L(ret):	FUNC_EXIT()
+	ret


More information about the gmp-commit mailing list