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

mercurial at gmplib.org mercurial at gmplib.org
Thu Mar 14 10:35:25 CET 2013


details:   /var/hg/gmp/rev/907ce85233f7
changeset: 15575:907ce85233f7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Mar 14 10:19:45 2013 +0100
description:
Break error message to keep within 80 char/line.

details:   /var/hg/gmp/rev/35a68dd045f0
changeset: 15576:35a68dd045f0
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Mar 14 10:34:45 2013 +0100
description:
Move from mulx/adx since we cannot currently prune missing.asm from path.

details:   /var/hg/gmp/rev/d9d55fa98fd5
changeset: 15577:d9d55fa98fd5
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Mar 14 10:35:21 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog                             |    8 ++
 acinclude.m4                          |    6 +-
 mpn/x86_64/missing-call.m4            |   42 ++++++++++++
 mpn/x86_64/missing-inline.m4          |   89 +++++++++++++++++++++++++
 mpn/x86_64/missing.asm                |  118 ++++++++++++++++++++++++++++++++++
 mpn/x86_64/mulx/adx/addmul_1.asm      |    2 +-
 mpn/x86_64/mulx/adx/missing-call.m4   |   42 ------------
 mpn/x86_64/mulx/adx/missing-inline.m4 |   89 -------------------------
 mpn/x86_64/mulx/adx/missing.asm       |  118 ----------------------------------
 9 files changed, 262 insertions(+), 252 deletions(-)

diffs (truncated from 572 to 300 lines):

diff -r 6e071cc68409 -r d9d55fa98fd5 ChangeLog
--- a/ChangeLog	Wed Mar 13 20:19:58 2013 +0100
+++ b/ChangeLog	Thu Mar 14 10:35:21 2013 +0100
@@ -1,3 +1,11 @@
+2013-03-14  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/x86_64/missing.asm: Move from mulx/adx since we cannot currently
+	prune missing.asm from path.
+	* mpn/x86_64/mulx/adx/missing-call.m4: Likewise.
+	* mpn/x86_64/mulx/adx/missing-inline.m4: Likewise.
+	* mpn/x86_64/mulx/adx/addmul_1.asm: Update hardwired path.
+
 2013-03-13 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpz/cong_2exp.c: Write loops in a cleaner way.
diff -r 6e071cc68409 -r d9d55fa98fd5 acinclude.m4
--- a/acinclude.m4	Wed Mar 13 20:19:58 2013 +0100
+++ b/acinclude.m4	Thu Mar 14 10:35:21 2013 +0100
@@ -2632,7 +2632,8 @@
 *)
   AC_MSG_WARN([+----------------------------------------------------------])
   AC_MSG_WARN([| WARNING WARNING WARNING])
-  AC_MSG_WARN([| Host CPU has the mulx instruction, but it can't be assembled by])
+  AC_MSG_WARN([| Host CPU has the mulx instruction, but it can't be])
+  AC_MSG_WARN([| assembled by])
   AC_MSG_WARN([|     $CCAS $CFLAGS $CPPFLAGS])
   AC_MSG_WARN([| Older x86 instructions will be used.])
   AC_MSG_WARN([| This will be an inferior build.])
@@ -2670,7 +2671,8 @@
 *)
   AC_MSG_WARN([+----------------------------------------------------------])
   AC_MSG_WARN([| WARNING WARNING WARNING])
-  AC_MSG_WARN([| Host CPU has the adcx and adox instructions, but they can't be assembled by])
+  AC_MSG_WARN([| Host CPU has the adcx and adox instructions, but they])
+  AC_MSG_WARN([| can't be assembled by])
   AC_MSG_WARN([|     $CCAS $CFLAGS $CPPFLAGS])
   AC_MSG_WARN([| Older x86 instructions will be used.])
   AC_MSG_WARN([| This will be an inferior build.])
diff -r 6e071cc68409 -r d9d55fa98fd5 mpn/x86_64/missing-call.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86_64/missing-call.m4	Thu Mar 14 10:35:21 2013 +0100
@@ -0,0 +1,42 @@
+dnl  AMD64 MULX/ADX simultion support, function call version.
+
+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/.
+
+
+define(`adox',`
+	push	$1
+	push	$2
+	call	__gmp_adox
+	pop	$2
+')
+
+define(`adcx',`
+	push	$1
+	push	$2
+	call	__gmp_adcx
+	pop	$2
+')
+
+define(`mulx',`
+	push	$1
+	call	__gmp_mulx
+	pop	$2
+	pop	$3
+')
diff -r 6e071cc68409 -r d9d55fa98fd5 mpn/x86_64/missing-inline.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86_64/missing-inline.m4	Thu Mar 14 10:35:21 2013 +0100
@@ -0,0 +1,89 @@
+dnl  AMD64 MULX/ADX simultion support, inline version.
+
+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/.
+
+
+define(`adox',`
+	push	$2
+	push	%rcx
+	push	%rbx
+	push	%rax
+	mov	$1, %rcx
+	pushfq
+	pushfq
+C copy 0(%rsp):11 to 0(%rsp):0
+	mov	(%rsp), %rbx
+	shr	%rbx
+	bt	$`'10, %rbx
+	adc	%rbx, %rbx
+	mov	%rbx, (%rsp)
+C put manipulated flags into eflags, execute a plain adc
+	popfq
+	adc	%rcx, 32(%rsp)
+C copy CF to 0(%rsp):11
+	mov	(%rsp), %rbx
+	sbb	R32(%rax), R32(%rax)
+	and	$`'0x800, R32(%rax)
+	and	$`'0xfffffffffffff7ff, %rbx
+	or	%rax, %rbx
+	mov	%rbx, (%rsp)
+C put manipulated flags into eflags
+	popfq
+	pop	%rax
+	pop	%rbx
+	pop	%rcx
+	pop	$2
+')
+
+define(`adcx',`
+	push	$2
+	push	%rcx
+	push	%rbx
+	push	%rax
+	mov	$1, %rcx
+	pushfq
+	adc	%rcx, 32(%rsp)
+	mov	(%rsp), %rbx
+	sbb	R32(%rax), R32(%rax)
+	and	$`'0xfffffffffffffffe, %rbx
+	sub	%rax, %rbx
+	mov	%rbx, (%rsp)
+	popfq
+	pop	%rax
+	pop	%rbx
+	pop	%rcx
+	pop	$2
+')
+
+define(`mulx',`
+	lea	-16(%rsp), %rsp
+	push	%rax
+	push	%rdx
+	pushfq			C preserve all flags
+	mov	$1, %rax
+	mul	%rdx
+	mov	%rax, 24(%rsp)
+	mov	%rdx, 32(%rsp)
+	popfq			C restore eflags
+	pop	%rdx
+	pop	%rax
+	pop	$2
+	pop	$3
+')
diff -r 6e071cc68409 -r d9d55fa98fd5 mpn/x86_64/missing.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86_64/missing.asm	Thu Mar 14 10:35:21 2013 +0100
@@ -0,0 +1,118 @@
+dnl  AMD64 MULX/ADX simultion support.
+
+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')
+
+ASM_START()
+
+C Fake the MULX instruction
+C
+C Accept the single explicit parameter on the stack, return the two result
+C words on the stack.  This calling convention means that we need to move the
+C return address up.
+C
+PROLOGUE(__gmp_mulx)
+	lea	-8(%rsp), %rsp
+	push	%rax
+	push	%rdx
+	pushfq				C preserve all flags
+	mov	32(%rsp), %rax		C move retaddr...
+	mov	%rax, 24(%rsp)		C ...up the stack
+	mov	40(%rsp), %rax		C input parameter
+	mul	%rdx
+	mov	%rax, 32(%rsp)
+	mov	%rdx, 40(%rsp)
+	popfq				C restore eflags
+	pop	%rdx
+	pop	%rax
+	ret
+EPILOGUE()
+PROTECT(__gmp_mulx)
+
+
+C Fake the ADOX instruction
+C
+C Accept the two parameters on the stack, return the result word on the stack.
+C This calling convention means that we need to move the return address down.
+C
+PROLOGUE(__gmp_adox)
+	push	%rcx
+	push	%rbx
+	push	%rax
+	mov	32(%rsp), %rcx		C src2
+	mov	24(%rsp), %rax		C move retaddr...
+	mov	%rax, 32(%rsp)		C ...down the stack
+	pushfq
+C copy 0(%rsp):11 to 0(%rsp):0
+	mov	(%rsp), %rbx
+	shr	%rbx
+	bt	$10, %rbx
+	adc	%rbx, %rbx
+	push	%rbx
+C put manipulated flags into eflags, execute a plain adc
+	popfq
+	adc	%rcx, 48(%rsp)
+C copy CF to 0(%rsp):11
+	pop	%rbx
+	sbb	R32(%rax), R32(%rax)
+	and	$0x800, R32(%rax)
+	and	$0xfffffffffffff7ff, %rbx
+	or	%rax, %rbx
+	push	%rbx
+C put manipulated flags into eflags
+	popfq
+	pop	%rax
+	pop	%rbx
+	pop	%rcx
+	lea	8(%rsp), %rsp
+	ret
+EPILOGUE()
+PROTECT(__gmp_adox)
+
+
+C Fake the ADCX instruction
+C
+C Accept the two parameters on the stack, return the result word on the stack.
+C This calling convention means that we need to move the return address down.
+C
+PROLOGUE(__gmp_adcx)
+	push	%rcx
+	push	%rbx
+	push	%rax
+	mov	32(%rsp), %rcx		C src2
+	mov	24(%rsp), %rax		C move retaddr...
+	mov	%rax, 32(%rsp)		C ...down the stack
+	pushfq
+	adc	%rcx, 48(%rsp)
+	pop	%rbx
+	sbb	R32(%rax), R32(%rax)
+	and	$`'0xfffffffffffffffe, %rbx
+	sub	%rax, %rbx
+	push	%rbx
+	popfq
+	pop	%rax
+	pop	%rbx
+	pop	%rcx
+	lea	8(%rsp), %rsp
+	ret
+EPILOGUE()
+PROTECT(__gmp_adcx)
diff -r 6e071cc68409 -r d9d55fa98fd5 mpn/x86_64/mulx/adx/addmul_1.asm


More information about the gmp-commit mailing list