[Gmp-commit] /var/hg/gmp: Support powerpc64le (by Ulrich Weigand).

mercurial at gmplib.org mercurial at gmplib.org
Fri Dec 13 11:23:06 UTC 2013


details:   /var/hg/gmp/rev/85e13c6f3293
changeset: 16100:85e13c6f3293
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 13 12:23:03 2013 +0100
description:
Support powerpc64le (by Ulrich Weigand).

diffstat:

 ChangeLog                            |  25 +++++++++++++++++++++++++
 configure.ac                         |   8 ++++++++
 mpn/powerpc64/aix.m4                 |   7 ++++---
 mpn/powerpc64/darwin.m4              |   8 +++++---
 mpn/powerpc64/elf.m4                 |  35 +++++++++++++++++++++++++++++------
 mpn/powerpc64/mode64/dive_1.asm      |   2 +-
 mpn/powerpc64/mode64/divrem_1.asm    |   2 +-
 mpn/powerpc64/mode64/divrem_2.asm    |   2 +-
 mpn/powerpc64/mode64/gcd_1.asm       |   2 +-
 mpn/powerpc64/mode64/invert_limb.asm |   2 +-
 mpn/powerpc64/mode64/mod_1_1.asm     |   2 +-
 mpn/powerpc64/mode64/mod_1_4.asm     |   2 +-
 mpn/powerpc64/mode64/mode1o.asm      |   2 +-
 mpn/powerpc64/mode64/p7/gcd_1.asm    |   2 +-
 mpn/powerpc64/p6/lshift.asm          |   2 +-
 mpn/powerpc64/p6/lshiftc.asm         |   2 +-
 mpn/powerpc64/p6/rshift.asm          |   2 +-
 mpn/powerpc64/vmx/popcount.asm       |   2 +-
 18 files changed, 84 insertions(+), 25 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r 52ba2a0e7ff8 -r 85e13c6f3293 ChangeLog
--- a/ChangeLog	Sat Dec 07 12:56:14 2013 +0100
+++ b/ChangeLog	Fri Dec 13 12:23:03 2013 +0100
@@ -1,3 +1,28 @@
+2013-12-09  Ulrich Weigand  <Ulrich.Weigand at de.ibm.com>
+
+	* configure.ac: Check for ELFv2 ABI on PowerPC.
+	* mpn/powerpc64/elf.m4: Set assembler ABI version for ELFv2
+	and use appropriate PROLOGUE_cpu/EPILOGUE_cpu sequences.
+	Support optional 'toc' parameter to PROLOGUE_cpu.
+	* mpn/powerpc64/aix.m4: Allow (and ignore) optional
+	'toc' parameter to PROLOGUE_cpu.
+	* mpn/powerpc64/darwin.m4: Likewise.
+
+	* mpn/powerpc64/mode64/dive_1.asm (mpn_divexact_1): Add 'toc'
+	parameter to PROLOGUE.
+	* mpn/powerpc64/mode64/divrem_1.asm (mpn_divrem_1): Likewise.
+	* mpn/powerpc64/mode64/divrem_2.asm (mpn_divrem_2): Likewise.
+	* mpn/powerpc64/mode64/gcd_1.asm (mpn_gcd_1): Likewise.
+	* mpn/powerpc64/mode64/invert_limb.asm (mpn_invert_limb): Likewise.
+	* mpn/powerpc64/mode64/mod_1_1.asm (mpn_mod_1_1p_cps): Likewise.
+	* mpn/powerpc64/mode64/mod_1_4.asm (mpn_mod_1s_4p_cps): Likewise.
+	* mpn/powerpc64/mode64/mode1o.asm (mpn_modexact_1c_odd): Likewise.
+	* mpn/powerpc64/mode64/p7/gcd_1.asm (mpn_gcd_1): Likewise.
+	* mpn/powerpc64/p6/lshift.asm (mpn_lshift): Likewise.
+	* mpn/powerpc64/p6/lshiftc.asm (mpn_lshiftc): Likewise.
+	* mpn/powerpc64/p6/rshift.asm (mpn_rshift): Likewise.
+	* mpn/powerpc64/vmx/popcount.asm (mpn_popcount): Likewise.
+
 2013-12-07  Niels Möller  <nisse at lysator.liu.se>
 
 	* configfsf.sub: Updated to version 2013-10-01, from gnulib.
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 configure.ac
--- a/configure.ac	Sat Dec 07 12:56:14 2013 +0100
+++ b/configure.ac	Fri Dec 13 12:23:03 2013 +0100
@@ -3504,6 +3504,14 @@
       GMP_ASM_POWERPC_PIC_ALWAYS
       GMP_ASM_POWERPC_R_REGISTERS
       GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
+
+      # Check for Linux ELFv2 ABI
+      AC_EGREP_CPP(yes,
+[#if _CALL_ELF == 2
+yes
+#endif],
+      [GMP_DEFINE_RAW(["define(<ELFv2_ABI>)"])])
+
       case $host in
         *-*-aix*)
 	  case $ABI in
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/aix.m4
--- a/mpn/powerpc64/aix.m4	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/aix.m4	Fri Dec 13 12:23:03 2013 +0100
@@ -22,14 +22,15 @@
 	`.machine	"any"
 	.toc')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 dnl  Don't want ELF style .size in the epilogue.
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-	`
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
 	.globl	$1
 	.globl	.$1
 	.csect	[DS], 3
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/darwin.m4
--- a/mpn/powerpc64/darwin.m4	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/darwin.m4	Fri Dec 13 12:23:03 2013 +0100
@@ -20,15 +20,17 @@
 
 define(`ASM_START',`')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`DARWIN')
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-`	.text
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+	.text
 	.globl	$1
 	.align	5
 $1:')
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/elf.m4
--- a/mpn/powerpc64/elf.m4	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/elf.m4	Fri Dec 13 12:23:03 2013 +0100
@@ -18,15 +18,33 @@
 dnl  You should have received a copy of the GNU Lesser General Public License
 dnl  along with the GNU MP Library.  If not, see https://www.gnu.org/licenses/.
 
-define(`ASM_START',`')
+define(`ASM_START',
+`ifdef(`ELFv2_ABI',
+`
+	.abiversion 2
+')')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-	`
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+ifdef(`ELFv2_ABI',
+`
+	.globl	$1
+	.type	$1, @function
+	.section	".text"
+	.align	5
+$1:
+ifelse(`$2',toc,`
+0:	addis	2, 12, (.TOC.-0b)@ha
+	addi	2, 2, (.TOC.-0b)@l
+	.localentry $1, .-$1
+',)
+',`
 	.globl	$1
 	.globl	.$1
 	.section	".opd","aw"
@@ -37,11 +55,16 @@
 	.type	.$1, @function
 	.section	".text"
 	.align	5
-.$1:')
+.$1:
+')')
 
 define(`EPILOGUE_cpu',
 m4_assert_numargs(1)
-`	.size	.$1, .-.$1')
+`ifdef(`ELFv2_ABI',`
+	.size	$1, .-$1
+',`
+	.size	.$1, .-.$1
+')')
 
 define(`TOC_ENTRY', `')
 
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/dive_1.asm
--- a/mpn/powerpc64/mode64/dive_1.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/dive_1.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -42,7 +42,7 @@
 
 EXTERN(binvert_limb_table)
 
-PROLOGUE(mpn_divexact_1)
+PROLOGUE(mpn_divexact_1,toc)
 	addic.	n, n, -1
 	ld	r12, 0(up)
 	bne	cr0, L(2)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/divrem_1.asm
--- a/mpn/powerpc64/mode64/divrem_1.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/divrem_1.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -45,7 +45,7 @@
 
 EXTERN_FUNC(mpn_invert_limb)
 
-PROLOGUE(mpn_divrem_1)
+PROLOGUE(mpn_divrem_1,toc)
 
 	mfcr	r12
 	add.	r10, r6, r4
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/divrem_2.asm
--- a/mpn/powerpc64/mode64/divrem_2.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/divrem_2.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -42,7 +42,7 @@
 
 EXTERN_FUNC(mpn_invert_limb)
 
-PROLOGUE(mpn_divrem_2)
+PROLOGUE(mpn_divrem_2,toc)
 	mflr	r0
 	std	r23, -72(r1)
 	std	r24, -64(r1)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/gcd_1.asm
--- a/mpn/powerpc64/mode64/gcd_1.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/gcd_1.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -36,7 +36,7 @@
 EXTERN_FUNC(mpn_modexact_1c_odd)
 
 ASM_START()
-PROLOGUE(mpn_gcd_1)
+PROLOGUE(mpn_gcd_1,toc)
 	mflr	r0
 	std	r30, -16(r1)
 	std	r31, -8(r1)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/invert_limb.asm
--- a/mpn/powerpc64/mode64/invert_limb.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/invert_limb.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -27,7 +27,7 @@
 C POWER7                66
 
 ASM_START()
-PROLOGUE(mpn_invert_limb)
+PROLOGUE(mpn_invert_limb,toc)
 	LEAL(	r12, approx_tab)
 	srdi	r9, r3, 32
 	rlwinm	r9, r9, 10, 23, 30	C (d >> 55) & 0x1fe
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/mod_1_1.asm
--- a/mpn/powerpc64/mode64/mod_1_1.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/mod_1_1.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -106,7 +106,7 @@
 	blr
 EPILOGUE()
 
-PROLOGUE(mpn_mod_1_1p_cps)
+PROLOGUE(mpn_mod_1_1p_cps,toc)
 	mflr	r0
 	std	r29, -24(r1)
 	std	r30, -16(r1)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/mod_1_4.asm
--- a/mpn/powerpc64/mode64/mod_1_4.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/mod_1_4.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -186,7 +186,7 @@
 	b	L(10)
 EPILOGUE()
 
-PROLOGUE(mpn_mod_1s_4p_cps)
+PROLOGUE(mpn_mod_1s_4p_cps,toc)
 	mflr	r0
 	std	r29, -24(r1)
 	std	r30, -16(r1)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/mode1o.asm
--- a/mpn/powerpc64/mode64/mode1o.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/mode1o.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -41,7 +41,7 @@
 
 EXTERN(binvert_limb_table)
 
-PROLOGUE(mpn_modexact_1c_odd)
+PROLOGUE(mpn_modexact_1c_odd,toc)
 	addic.	n, n, -1		C set carry as side effect
 	ld	r8, 0(up)
 	bne	cr0, L(2)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/mode64/p7/gcd_1.asm
--- a/mpn/powerpc64/mode64/p7/gcd_1.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/mode64/p7/gcd_1.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -36,7 +36,7 @@
 EXTERN_FUNC(mpn_modexact_1c_odd)
 
 ASM_START()
-PROLOGUE(mpn_gcd_1)
+PROLOGUE(mpn_gcd_1,toc)
 	mflr	r0
 	std	r30, -16(r1)
 	std	r31, -8(r1)
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/p6/lshift.asm
--- a/mpn/powerpc64/p6/lshift.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/p6/lshift.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -41,7 +41,7 @@
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_lshift)
+PROLOGUE(mpn_lshift,toc)
 
 ifdef(`HAVE_ABI_mode32',`
 	rldicl	n, n, 0,32		C FIXME: avoid this zero extend
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/p6/lshiftc.asm
--- a/mpn/powerpc64/p6/lshiftc.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/p6/lshiftc.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -41,7 +41,7 @@
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_lshiftc)
+PROLOGUE(mpn_lshiftc,toc)
 
 ifdef(`HAVE_ABI_mode32',`
 	rldicl	n, n, 0,32		C FIXME: avoid this zero extend
diff -r 52ba2a0e7ff8 -r 85e13c6f3293 mpn/powerpc64/p6/rshift.asm
--- a/mpn/powerpc64/p6/rshift.asm	Sat Dec 07 12:56:14 2013 +0100
+++ b/mpn/powerpc64/p6/rshift.asm	Fri Dec 13 12:23:03 2013 +0100
@@ -41,7 +41,7 @@
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_rshift)
+PROLOGUE(mpn_rshift,toc)
 
 ifdef(`HAVE_ABI_mode32',`
 	rldicl	n, n, 0,32		C FIXME: avoid this zero extend


More information about the gmp-commit mailing list