* config.links: OpenBSD 3.4 is now ELF, so use the proper assembler code

for that.  Use the portable C MPI code for OpenBSD before 3.4, and remove
the special i386-openbsd assembly directory.

* Makefile.am: Add the portable C links to DISTCLEANFILES.  Noted by
Nelson H. F. Beebe.

* mpi-mpow.c (build_index): s/index/idx/ to avoid gcc warning. From Werner
on stable branch.

* longlong.h: Added PowerPC 64 bit code from GPM-4.1.2 but didn't enable
it yet.  From Werner on stable branch.
This commit is contained in:
David Shaw 2004-01-12 00:51:39 +00:00
parent 5a57e36003
commit 666c582e36
5 changed files with 102 additions and 31 deletions

View File

@ -1,3 +1,19 @@
2004-01-11 David Shaw <dshaw@jabberwocky.com>
* config.links: OpenBSD 3.4 is now ELF, so use the proper
assembler code for that. Use the portable C MPI code for OpenBSD
before 3.4, and remove the special i386-openbsd assembly
directory.
* Makefile.am: Add the portable C links to DISTCLEANFILES. Noted
by Nelson H. F. Beebe.
* mpi-mpow.c (build_index): s/index/idx/ to avoid gcc warning.
From Werner on stable branch.
* longlong.h: Added PowerPC 64 bit code from GPM-4.1.2 but didn't
enable it yet. From Werner on stable branch.
2003-12-29 David Shaw <dshaw@jabberwocky.com>
* g10m.c: Dead code. Remove.

View File

@ -25,8 +25,11 @@ ASFLAGS = @MPI_SFLAGS@
EXTRA_DIST = config.links
DISTCLEANFILES = mpi-asm-defs.h \
mpih-add1.S mpih-mul1.S mpih-mul2.S mpih-mul3.S \
mpih-lshift.S mpih-rshift.S mpih-sub1.S asm-syntax.h sysdep.h
mpih-add1.S mpih-add1.c mpih-mul1.S mpih-mul1.c \
mpih-mul2.S mpih-mul2.c mpih-mul3.S mpih-mul3.c \
mpih-lshift.S mpih-lshift.c mpih-rshift.S mpih-rshift.c \
mpih-sub1.S mpih-sub1.c asm-syntax.h sysdep.h
# Note: we only use .S files so we should delete all left over .s
CLEANFILES = _*.s

View File

@ -1,6 +1,6 @@
# config.links - helper for ../configure
# Copyright (C) 1998, 1999, 2000, 2001, 2002,
# 2003 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
# 2004 Free Software Foundation, Inc.
#
# This file is part of GnuPG.
#
@ -33,10 +33,13 @@ echo "/* Target: ${target} */" >>./mpi/asm-syntax.h
if test "$try_asm_modules" = "yes" ; then
case "${target}" in
powerpc-apple-darwin*)
echo '/* No working assembler modules available */' >>./mpi/asm-syntax.h
path=""
;;
powerpc-apple-darwin* | \
i[34567]86*-*-openbsd[12]* | \
i[34567]86*-*-openbsd3.[0123]*)
echo '/* No working assembler modules available */' >>./mpi/asm-syntax.h
path=""
;;
i[3467]86*-*-openbsd* | \
i[3467]86*-*-freebsd*-elf | \
i[3467]86*-*-freebsd[3-9]* | \
i[3467]86*-*-freebsdelf* | \
@ -46,12 +49,13 @@ case "${target}" in
cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h
path="i386"
;;
i586*-*-freebsd*-elf | \
i586*-*-freebsd[3-9]* | \
i586*-*-freebsdelf* | \
i586*-*-netbsd* | \
i586*-*-k*bsd* | \
pentium-*-netbsd* | \
i586*-*-openbsd* | \
i586*-*-freebsd*-elf | \
i586*-*-freebsd[3-9]* | \
i586*-*-freebsdelf* | \
i586*-*-netbsd* | \
i586*-*-k*bsd* | \
pentium-*-netbsd* | \
pentiumpro-*-netbsd*)
echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h
@ -62,13 +66,6 @@ case "${target}" in
cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h
path="i386"
;;
# Use old assembler syntax for OpenBSD as their assembler is really old.
i[34567]86*-*-openbsd*)
echo '#define BSD_SYNTAX' >>./mpi/asm-syntax.h
echo '#define X86_BROKEN_ALIGN' >>./mpi/asm-syntax.h
cat $srcdir/mpi/i386-openbsd/syntax.h >>./mpi/asm-syntax.h
path="i386-openbsd"
;;
i[3467]86*-*-linuxaout* | \
i[3467]86*-*-linuxoldld* | \
i[3467]86*-*-*bsd*)

View File

@ -5,16 +5,16 @@ Copyright (C) 1991, 1992, 1993, 1994, 1996, 1998,
2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Library General Public License
You should have received a copy of the GNU Lesser General Public License
along with this file; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
@ -921,6 +921,63 @@ extern USItype __udiv_qrnnd ();
#endif
#endif /* Power architecture variants. */
/* Powerpc 64 bit support taken from gmp-4.1.2. */
/* We should test _IBMR2 here when we add assembly support for the system
vendor compilers. */
#if 0 /* Not yet enabled becuase we don't have hardware for a test. */
#if (defined (_ARCH_PPC) || defined (__powerpc__)) && W_TYPE_SIZE == 64
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
else \
__asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
: "=r" (sh), "=&r" (sl) \
: "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
} while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
else \
__asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
} while (0)
#define count_leading_zeros(count, x) \
__asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 64
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
(pl) = __m0 * __m1; \
} while (0)
#define UMUL_TIME 15
#define smul_ppmm(ph, pl, m0, m1) \
do { \
DItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
(pl) = __m0 * __m1; \
} while (0)
#define SMUL_TIME 14 /* ??? */
#define UDIV_TIME 120 /* ??? */
#endif /* 64-bit PowerPC. */
#endif /* if 0 */
/***************************************
************** PYR ******************

View File

@ -29,15 +29,15 @@ static int
build_index( MPI *exparray, int k, int i, int t )
{
int j, bitno;
int index = 0;
int idx = 0;
bitno = t-i;
for(j=k-1; j >= 0; j-- ) {
index <<= 1;
idx <<= 1;
if( mpi_test_bit( exparray[j], bitno ) )
index |= 1;
idx |= 1;
}
return index;
return idx;
}
/****************
@ -97,5 +97,3 @@ mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m)
mpi_free(G[i]);
m_free(G);
}