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

mercurial at gmplib.org mercurial at gmplib.org
Sun Jul 27 14:45:22 UTC 2014


details:   /var/hg/gmp/rev/d2b03b0066d7
changeset: 16454:d2b03b0066d7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jul 27 16:34:31 2014 +0200
description:
Cosmetic change.

details:   /var/hg/gmp/rev/734cfe6b1983
changeset: 16455:734cfe6b1983
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jul 27 16:40:23 2014 +0200
description:
Rewrite LEA, add LEAL.

details:   /var/hg/gmp/rev/b85b36d5529d
changeset: 16456:b85b36d5529d
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jul 27 16:44:25 2014 +0200
description:
Use LEAL.

details:   /var/hg/gmp/rev/ee3927e6fc88
changeset: 16457:ee3927e6fc88
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jul 27 16:44:48 2014 +0200
description:
ChangeLog

diffstat:

 ChangeLog            |  10 +++++++++-
 mpn/x86/darwin.m4    |  18 +++++++++++++++++-
 mpn/x86/k7/gcd_1.asm |  17 ++++++++++-------
 mpn/x86/p6/gcd_1.asm |   2 +-
 mpn/x86/x86-defs.m4  |  40 +++++++++++++++++++++++++++++++---------
 5 files changed, 68 insertions(+), 19 deletions(-)

diffs (206 lines):

diff -r c7a5c7e2bf70 -r ee3927e6fc88 ChangeLog
--- a/ChangeLog	Sat Jul 26 21:13:32 2014 +0200
+++ b/ChangeLog	Sun Jul 27 16:44:48 2014 +0200
@@ -1,3 +1,11 @@
+2014-07-27  Torbjörn Granlund  <tege at gmplib.org>
+
+	* mpn/x86/k7/gcd_1.asm: Use LEAL.
+
+	* mpn/x86/x86-defs.m4 (LEAL): New.
+	(LEA): Append to `load_eip' instead of ASM_END, like darwin.m4.
+	* mpn/x86/darwin.m4 (LEAL): New.
+
 2014-07-26  Torbjörn Granlund  <tege at gmplib.org>
 
 	* mpn/x86/pentium/mode1o.asm: Add Darwin PIC code.
@@ -9,7 +17,7 @@
 
 	* mpn/x86: Append ASM_END to many files.
 	* tests/x86call.asm: Append ASM_END.
-	
+
 	* mpn/x86/fat/fat_entry.asm (FAT_ENTRY, FAT_INIT):
 	Support Darwin.
 
diff -r c7a5c7e2bf70 -r ee3927e6fc88 mpn/x86/darwin.m4
--- a/mpn/x86/darwin.m4	Sat Jul 26 21:13:32 2014 +0200
+++ b/mpn/x86/darwin.m4	Sun Jul 27 16:44:48 2014 +0200
@@ -1,5 +1,5 @@
 divert(-1)
-dnl  Copyright 2007, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2007, 2011, 2012, 2014 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -31,6 +31,7 @@
 
 
 dnl  Usage LEA(symbol,reg)
+dnl  Usage LEAL(symbol_local_to_file,reg)
 dnl
 dnl  We maintain lists of stuff to append in load_eip and darwin_bd.  The
 dnl  `index' stuff is needed to suppress repeated definitions.  To avoid
@@ -61,6 +62,21 @@
 	movl	`$'$1, $2
 ')')
 
+define(`LEAL',
+m4_assert_numargs(2)
+`ifdef(`PIC',`
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
+	movl	(%esp), $2
+	ret_internal
+')')
+	call	L(movl_eip_`'substr($2,1))
+	leal	$1-.($2), $2
+',`
+	movl	`$'$1, $2
+')')
+
 
 dnl ASM_END
 
diff -r c7a5c7e2bf70 -r ee3927e6fc88 mpn/x86/k7/gcd_1.asm
--- a/mpn/x86/k7/gcd_1.asm	Sat Jul 26 21:13:32 2014 +0200
+++ b/mpn/x86/k7/gcd_1.asm	Sun Jul 27 16:44:48 2014 +0200
@@ -3,7 +3,8 @@
 dnl  Contributed to the GNU project by by Kevin Ryde.  Rehacked by Torbjorn
 dnl  Granlund.
 
-dnl  Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2000-2002, 2005, 2009, 2011, 2012, 2014 Free Software
+dnl  Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -53,6 +54,8 @@
 C TODO
 C  * Tune overhead, this takes 2-3 cycles more than old code when v0 is tiny.
 C  * Stream things better through registers, avoiding some copying.
+C  * For ELF, avoid putting GOT base in both ebx and esi.  Needs special
+C    LEA/LEAL or else discrete code here.
 
 C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
 
@@ -124,9 +127,9 @@
 	jmp	L(reduced)
 
 L(reduce_nby1):
-ifdef(`PIC_WITH_EBX',`
+ifdef(`PIC_WITH_EBX',`dnl
 	push	%ebx
-	call	L(movl_eip_to_ebx)
+	call	L(movl_eip_ebx)
 	add	$_GLOBAL_OFFSET_TABLE_, %ebx
 ')
 	push	v0			C param 3
@@ -141,13 +144,13 @@
 
 L(called):
 	add	$12, %esp		C deallocate params
-ifdef(`PIC_WITH_EBX',`
+ifdef(`PIC_WITH_EBX',`dnl
 	pop	%ebx
 ')
 L(reduced):
 	pop	%edx
 
-	LEA(	ctz_table, %esi)
+	LEAL(	ctz_table, %esi)
 	test	%eax, %eax
 	mov	%eax, %ecx
 	jnz	L(mid)
@@ -178,8 +181,8 @@
 	mov	%eax, %ecx
 	jmp	L(mid)
 
-ifdef(`PIC_WITH_EBX',`
-L(movl_eip_to_ebx):
+ifdef(`PIC_WITH_EBX',`dnl
+L(movl_eip_ebx):
 	mov	(%esp), %ebx
 	ret
 ')
diff -r c7a5c7e2bf70 -r ee3927e6fc88 mpn/x86/p6/gcd_1.asm
--- a/mpn/x86/p6/gcd_1.asm	Sat Jul 26 21:13:32 2014 +0200
+++ b/mpn/x86/p6/gcd_1.asm	Sun Jul 27 16:44:48 2014 +0200
@@ -94,7 +94,7 @@
 L(reduce_nby1):
 	cmp	$BMOD_1_TO_MOD_1_THRESHOLD, n
 	jl	L(bmod)
-ifdef(`PIC_WITH_EBX',`
+ifdef(`PIC_WITH_EBX',`dnl
 	push	%ebx
 	call	L(movl_eip_to_ebx)
 	add	$_GLOBAL_OFFSET_TABLE_, %ebx
diff -r c7a5c7e2bf70 -r ee3927e6fc88 mpn/x86/x86-defs.m4
--- a/mpn/x86/x86-defs.m4	Sat Jul 26 21:13:32 2014 +0200
+++ b/mpn/x86/x86-defs.m4	Sun Jul 27 16:44:48 2014 +0200
@@ -1,10 +1,8 @@
 divert(-1)
 
-
 dnl  m4 macros for x86 assembler.
 
-
-dnl  Copyright 1999-2003, 2007, 2010, 2012 Free Software Foundation, Inc.
+dnl  Copyright 1999-2003, 2007, 2010, 2012, 2014 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -954,16 +952,17 @@
 
 
 dnl  Usage LEA(symbol,reg)
+dnl  Usage LEAL(symbol_local_to_file,reg)
 
 define(`LEA',
 m4_assert_numargs(2)
-`ifdef(`PIC',`
-define(`ASM_END',
-`
-L(movl_eip_`'substr($2,1)):
+`ifdef(`PIC',`dnl
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
 	movl	(%esp), $2
-	ret_internal')
-
+	ret_internal
+')')dnl
 	call	L(movl_eip_`'substr($2,1))
 	addl	$_GLOBAL_OFFSET_TABLE_, $2
 	movl	$1 at GOT($2), $2
@@ -971,6 +970,29 @@
 	movl	`$'$1, $2
 ')')
 
+define(`LEAL',
+m4_assert_numargs(2)
+`ifdef(`PIC',`dnl
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
+	movl	(%esp), $2
+	ret_internal
+')')dnl
+	call	L(movl_eip_`'substr($2,1))
+	addl	$_GLOBAL_OFFSET_TABLE_, $2
+	leal	$1 at GOTOFF($2), $2
+',`
+	movl	`$'$1, $2
+')')
+
+dnl ASM_END
+
+define(`ASM_END',`load_eip')
+
+define(`load_eip', `')		dnl updated in LEA/LEAL
+
+
 define(`DEF_OBJECT',
 m4_assert_numargs_range(1,2)
 	`RODATA


More information about the gmp-commit mailing list