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

mercurial at gmplib.org mercurial at gmplib.org
Mon Mar 19 23:17:14 CET 2012


details:   /var/hg/gmp/rev/e4e0aa3872f7
changeset: 14771:e4e0aa3872f7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Mar 19 23:15:21 2012 +0100
description:
(CALL, PIC_WITH_EBX): New macros.

details:   /var/hg/gmp/rev/cc6d3a923da6
changeset: 14772:cc6d3a923da6
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Mar 19 23:17:11 2012 +0100
description:
Use new macros to support PIC.

diffstat:

 ChangeLog            |   7 +++++++
 mpn/x86/darwin.m4    |   9 +++++++++
 mpn/x86/k7/gcd_1.asm |  27 +++++++++++++++++----------
 mpn/x86/p6/gcd_1.asm |  35 ++++++++++++++++++++++++-----------
 mpn/x86/x86-defs.m4  |  13 +++++++++++++
 5 files changed, 70 insertions(+), 21 deletions(-)

diffs (162 lines):

diff -r 38b5f7f759cc -r cc6d3a923da6 ChangeLog
--- a/ChangeLog	Mon Mar 19 22:43:38 2012 +0100
+++ b/ChangeLog	Mon Mar 19 23:17:11 2012 +0100
@@ -1,3 +1,10 @@
+2012-03-19  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/x86/x86-defs.m4 (CALL, PIC_WITH_EBX): New macros.
+	* mpn/x86/darwin.m4: Likewise.
+	* mpn/x86/k7/gcd_1.asm: Use new macros to support PIC.
+	* mpn/x86/p6/gcd_1.asm: Likewise.
+
 2012-03-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpz/oddfac_1.c: Improve ASSERTs.
diff -r 38b5f7f759cc -r cc6d3a923da6 mpn/x86/darwin.m4
--- a/mpn/x86/darwin.m4	Mon Mar 19 22:43:38 2012 +0100
+++ b/mpn/x86/darwin.m4	Mon Mar 19 23:17:11 2012 +0100
@@ -66,4 +66,13 @@
 define(`darwin_bd', `')		dnl updated in LEA
 
 
+dnl  Usage: CALL(funcname)
+dnl
+
+define(`CALL',
+m4_assert_numargs(1)
+`call	GSYM_PREFIX`'$1')
+
+undefine(`PIC_WITH_EBX')
+
 divert`'dnl
diff -r 38b5f7f759cc -r cc6d3a923da6 mpn/x86/k7/gcd_1.asm
--- a/mpn/x86/k7/gcd_1.asm	Mon Mar 19 22:43:38 2012 +0100
+++ b/mpn/x86/k7/gcd_1.asm	Mon Mar 19 23:17:11 2012 +0100
@@ -114,25 +114,26 @@
 	jmp	L(reduced)
 
 L(reduce_nby1):
+ifdef(`PIC_WITH_EBX',`
+	push	%ebx
+	call	L(movl_eip_to_ebx)
+	add	$_GLOBAL_OFFSET_TABLE_, %ebx
+')
 	push	v0			C param 3
 	push	n			C param 2
 	push	up			C param 1
 	cmp	$BMOD_1_TO_MOD_1_THRESHOLD, n
 	jl	L(bmod)
-ifdef(`PIC',`
-	call	GSYM_PREFIX`'mpn_mod_1 at PLT
-',`
-	call	GSYM_PREFIX`'mpn_mod_1
-')
+	CALL(	mpn_mod_1)
 	jmp	L(called)
 L(bmod):
-ifdef(`PIC',`
-	call	GSYM_PREFIX`'mpn_modexact_1_odd at PLT
-',`
-	call	GSYM_PREFIX`'mpn_modexact_1_odd
-')
+	CALL(	mpn_modexact_1_odd)
+
 L(called):
 	add	$12, %esp		C deallocate params
+ifdef(`PIC_WITH_EBX',`
+	pop	%ebx
+')
 L(reduced):
 	pop	%edx
 
@@ -166,4 +167,10 @@
 	shr	$MAXSHIFT, %eax
 	mov	%eax, %ecx
 	jmp	L(mid)
+
+ifdef(`PIC_WITH_EBX',`
+L(movl_eip_to_ebx):
+	mov	(%esp), %ebx
+	ret
+')
 EPILOGUE()
diff -r 38b5f7f759cc -r cc6d3a923da6 mpn/x86/p6/gcd_1.asm
--- a/mpn/x86/p6/gcd_1.asm	Mon Mar 19 22:43:38 2012 +0100
+++ b/mpn/x86/p6/gcd_1.asm	Mon Mar 19 23:17:11 2012 +0100
@@ -84,26 +84,33 @@
 L(reduce_nby1):
 	cmp	$BMOD_1_TO_MOD_1_THRESHOLD, n
 	jl	L(bmod)
+ifdef(`PIC_WITH_EBX',`
+	push	%ebx
+	call	L(movl_eip_to_ebx)
+	add	$_GLOBAL_OFFSET_TABLE_, %ebx
+')
 	push	v0		C param 3
 	push	n		C param 2
 	push	up		C param 1
-ifdef(`PIC',`
-	call	GSYM_PREFIX`'mpn_mod_1 at PLT
-',`
-	call	GSYM_PREFIX`'mpn_mod_1
+	CALL(	mpn_mod_1)
+	jmp	L(called)
+
+L(bmod):
+ifdef(`PIC_WITH_EBX',`dnl
+	push	%ebx
+	call	L(movl_eip_to_ebx)
+	add	$_GLOBAL_OFFSET_TABLE_, %ebx
 ')
-	jmp	L(called)
-L(bmod):
 	push	v0		C param 3
 	push	n		C param 2
 	push	up		C param 1
-ifdef(`PIC',`
-	call	GSYM_PREFIX`'mpn_modexact_1_odd at PLT
-',`
-	call	GSYM_PREFIX`'mpn_modexact_1_odd
-')
+	CALL(	mpn_modexact_1_odd)
+
 L(called):
 	add	$12, %esp	C deallocate params
+ifdef(`PIC_WITH_EBX',`dnl
+	pop	%ebx
+')
 L(reduced):
 	pop	%edx
 
@@ -130,4 +137,10 @@
 	pop	%esi
 	pop	%edi
 	ret
+
+ifdef(`PIC_WITH_EBX',`dnl
+L(movl_eip_to_ebx):
+	mov	(%esp), %ebx
+	ret
+')
 EPILOGUE()
diff -r 38b5f7f759cc -r cc6d3a923da6 mpn/x86/x86-defs.m4
--- a/mpn/x86/x86-defs.m4	Mon Mar 19 22:43:38 2012 +0100
+++ b/mpn/x86/x86-defs.m4	Mon Mar 19 23:17:11 2012 +0100
@@ -971,4 +971,17 @@
 m4_assert_numargs(1)
 `	SIZE(`$1',.-`$1')')
 
+dnl  Usage: CALL(funcname)
+dnl
+
+define(`CALL',
+m4_assert_numargs(1)
+`ifdef(`PIC',
+  `call	GSYM_PREFIX`'$1 at PLT',
+  `call	GSYM_PREFIX`'$1')')
+
+ifdef(`PIC',
+`define(`PIC_WITH_EBX')',
+`undefine(`PIC_WITH_EBX')')
+
 divert`'dnl


More information about the gmp-commit mailing list