[Gmp-commit] /home/hgfiles/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri Jan 15 16:58:09 CET 2010


details:   /home/hgfiles/gmp/rev/b784f664269f
changeset: 13374:b784f664269f
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Jan 15 11:39:53 2010 +0100
description:
Make file work for Mac OS/64.

details:   /home/hgfiles/gmp/rev/0e7b8f70f737
changeset: 13375:0e7b8f70f737
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Jan 15 11:42:49 2010 +0100
description:
Make file work for Mac OS/32.

details:   /home/hgfiles/gmp/rev/5026e22e74c3
changeset: 13376:5026e22e74c3
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Jan 15 12:28:45 2010 +0100
description:
(LEA): New define.

diffstat:

 ChangeLog               |  12 ++++++++++++
 mpn/x86/invert_limb.asm |  12 +++++++++---
 mpn/x86_64/darwin.m4    |   4 ++++
 mpn/x86_64/gcd_1.asm    |  14 ++++++--------
 4 files changed, 31 insertions(+), 11 deletions(-)

diffs (130 lines):

diff -r 5b7c5bb287e5 -r 5026e22e74c3 ChangeLog
--- a/ChangeLog	Tue Jan 12 23:50:39 2010 +0100
+++ b/ChangeLog	Fri Jan 15 12:28:45 2010 +0100
@@ -1,3 +1,15 @@
+2010-01-15  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/x86_64/darwin.m4 (LEA): New define.
+
+	* mpn/x86/invert_limb.asm (approx_tab): Use DEF_OBJECT.
+	Rename and globalise it to work around Mac OS bug.
+
+	With Philip McLaughlin:
+	* mpn/x86_64/gcd_1.asm (ctz_table): Don't use local prefix, but
+	use DEF_OBJECT...END_OBJECT.
+	Keep stack pointer at ABI mandated alignment over call.
+
 2010-01-12  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tune/speed.c (routine): Remove obsolete mpn_dc_tdiv_qr and
diff -r 5b7c5bb287e5 -r 5026e22e74c3 mpn/x86/invert_limb.asm
--- a/mpn/x86/invert_limb.asm	Tue Jan 12 23:50:39 2010 +0100
+++ b/mpn/x86/invert_limb.asm	Fri Jan 15 12:28:45 2010 +0100
@@ -33,6 +33,13 @@
 
 defframe(PARAM_DIVISOR,4)
 
+ASM_START()
+
+C Make approx_tab global to work around Apple relocation bug.
+ifdef(`DARWIN',`
+	define(`approx_tab', MPN(invert_limb_tab))
+	GLOBL	approx_tab')
+
 	TEXT
 	ALIGN(16)
 PROLOGUE(mpn_invert_limb)
@@ -95,9 +102,7 @@
 
 EPILOGUE()
 
-	RODATA
-	ALIGN(2)
-approx_tab:
+DEF_OBJECT(approx_tab,2)
 	.value	0x7fe1,0x7fa1,0x7f61,0x7f22,0x7ee3,0x7ea4,0x7e65,0x7e27
 	.value	0x7de9,0x7dab,0x7d6d,0x7d30,0x7cf3,0x7cb6,0x7c79,0x7c3d
 	.value	0x7c00,0x7bc4,0x7b89,0x7b4d,0x7b12,0x7ad7,0x7a9c,0x7a61
@@ -162,3 +167,4 @@
 	.value	0x4179,0x4168,0x4157,0x4147,0x4136,0x4125,0x4115,0x4104
 	.value	0x40f4,0x40e3,0x40d3,0x40c2,0x40b2,0x40a2,0x4091,0x4081
 	.value	0x4071,0x4061,0x4050,0x4040,0x4030,0x4020,0x4010,0x4000
+END_OBJECT(approx_tab)
diff -r 5b7c5bb287e5 -r 5026e22e74c3 mpn/x86_64/darwin.m4
--- a/mpn/x86_64/darwin.m4	Tue Jan 12 23:50:39 2010 +0100
+++ b/mpn/x86_64/darwin.m4	Fri Jan 15 12:28:45 2010 +0100
@@ -18,6 +18,10 @@
 
 define(`DARWIN')
 
+define(`LEA',`
+	mov	$1(%rip), $2
+')
+
 dnl  Usage: CALL(funcname)
 dnl
 dnl  Simply override the definition in x86_64-defs.m4.
diff -r 5b7c5bb287e5 -r 5026e22e74c3 mpn/x86_64/gcd_1.asm
--- a/mpn/x86_64/gcd_1.asm	Tue Jan 12 23:50:39 2010 +0100
+++ b/mpn/x86_64/gcd_1.asm	Fri Jan 15 12:28:45 2010 +0100
@@ -36,20 +36,18 @@
 deflit(DIV_THRESHOLD, 23)
 
 
-C table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
 
 
 deflit(MAXSHIFT, 6)
 deflit(MASK, eval((1<<MAXSHIFT)-1))
 
-	RODATA
-	ALIGN(64)
-L(table):
+DEF_OBJECT(ctz_table,64)
 	.byte	MAXSHIFT
 forloop(i,1,MASK,
 `	.byte	m4_count_trailing_zeros(i)
 ')
-
+END_OBJECT(ctz_table)
 
 C mp_limb_t mpn_gcd_1 (mp_srcptr up, mp_size_t n, mp_limb_t vlimb);
 
@@ -64,7 +62,6 @@
 
 PROLOGUE(mpn_gcd_1)
 	mov	(%rdi), %r8		C src low limb
-	mov	%r8, %r10
 	or	%rdx, %r8		C x | y
 	mov	$-1, R32(%rcx)
 
@@ -73,7 +70,6 @@
 	shr	%r8
 	jnc	L(twos)
 
-	shr	R8(%rcx), %r10
 	shr	R8(%rcx), %rdx
 	mov	R32(%rcx), R32(%r8)	C common twos
 
@@ -84,9 +80,11 @@
 
 	push	%r8
 	push	%rdx
+	sub	$8, %rsp		C maintain ABI required rsp alignment
 
 	CALL(	mpn_modexact_1_odd)
 
+	add	$8, %rsp
 	pop	%rdx
 	pop	%r8
 
@@ -99,7 +97,7 @@
 	jmp	L(done)
 
 L(strip_x):
-	LEA(	L(table), %r9)
+	LEA(	ctz_table, %r9)
 	jmp	L(strip_x_top)
 
 	ALIGN(16)


More information about the gmp-commit mailing list