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

mercurial at gmplib.org mercurial at gmplib.org
Sat Jul 26 19:13:43 UTC 2014


details:   /var/hg/gmp/rev/1aab73a331ad
changeset: 16452:1aab73a331ad
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jul 26 21:11:19 2014 +0200
description:
Support Darwin for all x86-32 CPUs, including fat builds.

details:   /var/hg/gmp/rev/c7a5c7e2bf70
changeset: 16453:c7a5c7e2bf70
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jul 26 21:13:32 2014 +0200
description:
*** empty log message ***

diffstat:

 ChangeLog                          |  23 +++++++++++++++++++++
 NEWS                               |   2 +
 mpn/x86/bdiv_q_1.asm               |   2 +-
 mpn/x86/darwin.m4                  |   4 +-
 mpn/x86/dive_1.asm                 |   1 +
 mpn/x86/fat/fat_entry.asm          |  41 +++++++++++++++++++++++++++++--------
 mpn/x86/k6/gcd_1.asm               |  13 ++++-------
 mpn/x86/k6/mmx/dive_1.asm          |   1 +
 mpn/x86/k6/mode1o.asm              |   1 +
 mpn/x86/k7/bdiv_q_1.asm            |   1 +
 mpn/x86/k7/dive_1.asm              |   1 +
 mpn/x86/k7/gcd_1.asm               |   1 +
 mpn/x86/k7/invert_limb.asm         |   1 +
 mpn/x86/k7/mode1o.asm              |   1 +
 mpn/x86/p6/bdiv_q_1.asm            |   1 +
 mpn/x86/p6/dive_1.asm              |   1 +
 mpn/x86/p6/mode1o.asm              |   1 +
 mpn/x86/pentium/bdiv_q_1.asm       |   8 ++++++-
 mpn/x86/pentium/dive_1.asm         |  18 ++++------------
 mpn/x86/pentium/hamdist.asm        |  14 ++++++++++--
 mpn/x86/pentium/mode1o.asm         |  17 +++++++++++++-
 mpn/x86/pentium/popcount.asm       |  13 ++++++++++-
 mpn/x86/pentium4/sse2/bdiv_q_1.asm |   1 +
 mpn/x86/pentium4/sse2/dive_1.asm   |   1 +
 mpn/x86/pentium4/sse2/mode1o.asm   |   1 +
 mpn/x86/pentium4/sse2/popcount.asm |   1 +
 mpn/x86/x86-defs.m4                |   5 +--
 tests/x86call.asm                  |   1 +
 28 files changed, 132 insertions(+), 44 deletions(-)

diffs (truncated from 558 to 300 lines):

diff -r 33b76792d0cb -r c7a5c7e2bf70 ChangeLog
--- a/ChangeLog	Sat Jul 05 23:14:57 2014 +0200
+++ b/ChangeLog	Sat Jul 26 21:13:32 2014 +0200
@@ -1,3 +1,24 @@
+2014-07-26  Torbjörn Granlund  <tege at gmplib.org>
+
+	* mpn/x86/pentium/mode1o.asm: Add Darwin PIC code.
+	* mpn/x86/pentium/bdiv_q_1.asm: Likewise.
+	* mpn/x86/pentium/dive_1.asm: Likewise.
+	* mpn/x86/pentium/popcount.asm: Likewise.
+	* mpn/x86/pentium/hamdist.asm: Likewise.
+	* mpn/x86/k6/gcd_1.asm: Likewise.
+
+	* 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.
+
+	* mpn/x86/darwin.m4 (ASM_END): New, body from EPILOGUE_cpu.
+	(EPILOGUE_cpu): Remove.
+
+	* mpn/x86/x86-defs.m4 (LEA): Put `mov_eip_' thunks in ASM_END instead
+	of EPILOGUE_cpu.
+
 2014-07-05  Niels Möller  <nisse at lysator.liu.se>
 
 	* doc/gmp.texi (Low-level Functions): Document that scratch need
@@ -7,6 +28,8 @@
 
 2014-07-02  Torbjörn Granlund  <tege at gmplib.org>
 
+	* mpn/x86_64/x86_64-defs.m4: Fix quoting.
+
 	mpn/x86_64/atom/redc_1.asm: Enforce proper stack allocation.
 	mpn/x86_64/bobcat/redc_1.asm: Likewise.
 	mpn/x86_64/core2/divrem_1.asm: Likewise.
diff -r 33b76792d0cb -r c7a5c7e2bf70 NEWS
--- a/NEWS	Sat Jul 05 23:14:57 2014 +0200
+++ b/NEWS	Sat Jul 26 21:13:32 2014 +0200
@@ -9,6 +9,8 @@
   FEATURES
   * New C++ functions gcd and lcm for mpz_class.
 
+  * Support for Darwin in all x86 code, including in fat builds.
+
 
 Changes between GMP version 5.1.* and 6.0.0
 
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/bdiv_q_1.asm
--- a/mpn/x86/bdiv_q_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/bdiv_q_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -205,4 +205,4 @@
 
 	jmp	L(common)
 EPILOGUE()
-
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/darwin.m4
--- a/mpn/x86/darwin.m4	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/darwin.m4	Sat Jul 26 21:13:32 2014 +0200
@@ -62,9 +62,9 @@
 ')')
 
 
-dnl EPILOGUE_cpu
+dnl ASM_END
 
-define(`EPILOGUE_cpu',`load_eip`'darwin_bd')
+define(`ASM_END',`load_eip`'darwin_bd')
 
 define(`load_eip', `')		dnl updated in LEA
 define(`darwin_bd', `')		dnl updated in LEA
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/dive_1.asm
--- a/mpn/x86/dive_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/dive_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -187,3 +187,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/fat/fat_entry.asm
--- a/mpn/x86/fat/fat_entry.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/fat/fat_entry.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -1,6 +1,6 @@
 dnl  x86 fat binary entrypoints.
 
-dnl  Copyright 2003, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -66,13 +66,19 @@
 define(FAT_ENTRY,
 m4_assert_numargs(2)
 `	ALIGN(ifdef(`PIC',16,8))
-`'PROLOGUE($1)
-ifdef(`PIC',
-`	call	L(movl_eip_edx)
+`'PROLOGUE($1)dnl
+ifdef(`PIC',`dnl
+ifdef(`DARWIN',`
+	call	L(movl_eip_edx)
+	movl	L(___gmpn_cpuvec)$non_lazy_ptr-.(%edx), %edx
+	jmp	*m4_empty_if_zero($2)(%edx)
+',`dnl
+	call	L(movl_eip_edx)
 L(entry_here$2):
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-L(entry_here$2)], %edx
 	movl	GSYM_PREFIX`'__gmpn_cpuvec at GOT(%edx), %edx
 	jmp	*m4_empty_if_zero($2)(%edx)
+')
 ',`dnl non-PIC
 	jmp	*GSYM_PREFIX`'__gmpn_cpuvec+$2
 ')
@@ -94,6 +100,13 @@
 L(movl_eip_edx):
 	movl	(%esp), %edx
 	ret_internal
+ifdef(`DARWIN',`
+	.section	__IMPORT,__pointers,non_lazy_symbol_pointers
+L(___gmpn_cpuvec)$non_lazy_ptr:
+	.indirect_symbol	___gmpn_cpuvec
+	.long	0
+	TEXT
+')
 ')
 
 
@@ -120,7 +133,7 @@
 
 define(FAT_INIT,
 m4_assert_numargs(2)
-`PROLOGUE($1)
+`PROLOGUE($1)dnl
 	movb	$`'$2, %al
 	jmp	L(fat_init)
 EPILOGUE()
@@ -132,23 +145,32 @@
 	movzbl	%al, %eax
 	pushl	%eax
 
-ifdef(`PIC',`
+ifdef(`PIC',`dnl
+ifdef(`DARWIN',`
+	sub	$8, %esp
+	CALL(	__gmpn_cpuvec_init)
+	add	$8, %esp
+	call	L(movl_eip_edx)
+	movl	L(___gmpn_cpuvec)$non_lazy_ptr-.(%edx), %edx
+',`dnl
 	pushl	%ebx
 	call	L(movl_eip_ebx)
 L(init_here):
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-L(init_here)], %ebx
-	call	GSYM_PREFIX`'__gmpn_cpuvec_init at PLT
+	CALL(	__gmpn_cpuvec_init)
 	movl	GSYM_PREFIX`'__gmpn_cpuvec at GOT(%ebx), %edx
 	popl	%ebx
+')
 	popl	%eax
 	jmp	*(%edx,%eax)
 
 L(movl_eip_ebx):
 	movl	(%esp), %ebx
 	ret_internal
-
 ',`dnl non-PIC
-	call	GSYM_PREFIX`'__gmpn_cpuvec_init
+	sub	$8, %esp		C needed on Darwin, harmless elsewhere
+	CALL(	__gmpn_cpuvec_init)
+	add	$8, %esp		C needed on Darwin, harmless elsewhere
 	popl	%eax
 	jmp	*GSYM_PREFIX`'__gmpn_cpuvec(%eax)
 ')
@@ -218,3 +240,4 @@
 L(available):
 	ret
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k6/gcd_1.asm
--- a/mpn/x86/k6/gcd_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k6/gcd_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -1,6 +1,6 @@
 dnl  AMD K6 mpn_gcd_1 -- mpn by 1 gcd.
 
-dnl  Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+dnl  Copyright 2000-2002, 2004, 2014 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -321,15 +321,12 @@
 
 	pushl	%ebx		FRAME_pushl()
 
-ifdef(`PIC',`
+ifdef(`PIC_WITH_EBX',`
 	nop	C code alignment
 	call	L(movl_eip_ebx)
-L(here):
-	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-	call	GSYM_PREFIX`'mpn_modexact_1_odd at PLT
-',`
-	call	GSYM_PREFIX`'mpn_modexact_1_odd
+	add	$_GLOBAL_OFFSET_TABLE_, %ebx
 ')
+	CALL(	mpn_modexact_1_odd)
 
 	movl	%esi, %edx		C y odd
 	movl	SAVE_ESI, %esi
@@ -353,7 +350,7 @@
 	ret
 
 
-ifdef(`PIC',`
+ifdef(`PIC_WITH_EBX',`
 L(movl_eip_ebx):
 	movl	(%esp), %ebx
 	ret_internal
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k6/mmx/dive_1.asm
--- a/mpn/x86/k6/mmx/dive_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k6/mmx/dive_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -279,3 +279,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k6/mode1o.asm
--- a/mpn/x86/k6/mode1o.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k6/mode1o.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -173,3 +173,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k7/bdiv_q_1.asm
--- a/mpn/x86/k7/bdiv_q_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k7/bdiv_q_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -242,3 +242,4 @@
 
 	jmp	L(common)
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k7/dive_1.asm
--- a/mpn/x86/k7/dive_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k7/dive_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -205,3 +205,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k7/gcd_1.asm
--- a/mpn/x86/k7/gcd_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k7/gcd_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -184,3 +184,4 @@
 	ret
 ')
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k7/invert_limb.asm
--- a/mpn/x86/k7/invert_limb.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k7/invert_limb.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -191,3 +191,4 @@
 	.value	0x40f4,0x40e3,0x40d3,0x40c2,0x40b2,0x40a2,0x4091,0x4081
 	.value	0x4071,0x4061,0x4050,0x4040,0x4030,0x4020,0x4010,0x4000
 END_OBJECT(approx_tab)
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/k7/mode1o.asm
--- a/mpn/x86/k7/mode1o.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/k7/mode1o.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -178,3 +178,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/p6/bdiv_q_1.asm
--- a/mpn/x86/p6/bdiv_q_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/p6/bdiv_q_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -284,3 +284,4 @@
 	jmp	L(common)
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/p6/dive_1.asm
--- a/mpn/x86/p6/dive_1.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/p6/dive_1.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -264,3 +264,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/p6/mode1o.asm
--- a/mpn/x86/p6/mode1o.asm	Sat Jul 05 23:14:57 2014 +0200
+++ b/mpn/x86/p6/mode1o.asm	Sat Jul 26 21:13:32 2014 +0200
@@ -167,3 +167,4 @@
 	ret
 
 EPILOGUE()
+ASM_END()
diff -r 33b76792d0cb -r c7a5c7e2bf70 mpn/x86/pentium/bdiv_q_1.asm


More information about the gmp-commit mailing list