1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

How with some assembly support

This commit is contained in:
Werner Koch 1997-11-26 22:02:28 +00:00
parent a0196dfb18
commit 9479cf7e24
23 changed files with 2497 additions and 178 deletions

View file

@ -3,8 +3,10 @@
INCLUDES = -I$(top_srcdir)/include
CFLAGS += -O2
noinst_LIBRARIES = mpi
SUFFIXES = .S .s
noinst_LIBRARIES = mpi
noinst_HEADERS = sysdep.h
mpi_SOURCES = longlong.h \
mpi-add.c \
@ -19,18 +21,28 @@ mpi_SOURCES = longlong.h \
mpi-pow.c \
mpi-scan.c \
mpicoder.c \
mpih-add.c \
mpih-cmp.c \
mpih-add.c \
mpih-sub.c \
mpih-div.c \
mpih-mul.c \
mpih-shift.c \
mpih-sub.c \
mpih-mul1.S \
mpih-mul2.S \
mpih-add1.S \
mpih-mul3.S \
mpih-sub1.S \
mpih-shift.S \
mpih-add.S \
mpiutil.c
mpi_LIBADD = mpih-mul1.o \
mpih-mul2.o \
mpih-mul3.o \
mpih-add1.o \
mpih-sub1.o \
mpih-shift.o
#mpi_DEPENDENCIES = mpih-mul1.S \
# mpih-mul2.S \
# mpih-mul3.S \
# mpih-add1.S \
# mpih-sub1.S \
# mpih-shift.S
#
##DISTCLEANFILES = @MPI_DISTCLEANFILES@

View file

@ -40,27 +40,37 @@ transform = @program_transform_name@
INCLUDES = -I$(top_srcdir)/include
noinst_LIBRARIES = mpi
SUFFIXES = .S .s
mpi_SOURCES = longlong.h \
mpi-add.c \
mpi-bit.c \
mpi-cmp.c \
mpi-div.c \
mpi-gcd.c \
mpi-internal.h \
mpi-inv.c \
mpi-mul.c \
mpi-pow.c \
mpi-scan.c \
mpicoder.c \
mpihelp-add.c \
mpihelp-cmp.c \
mpihelp-div.c \
mpihelp-mul.c \
mpihelp-shift.c \
mpihelp-sub.c \
noinst_LIBRARIES = mpi
noinst_HEADERS = sysdep.h
mpi_SOURCES = longlong.h \
mpi-add.c \
mpi-bit.c \
mpi-cmp.c \
mpi-div.c \
mpi-gcd.c \
mpi-internal.h \
mpi-inline.h \
mpi-inv.c \
mpi-mul.c \
mpi-pow.c \
mpi-scan.c \
mpicoder.c \
mpih-cmp.c \
mpih-add.c \
mpih-sub.c \
mpih-div.c \
mpih-mul.c \
mpiutil.c
mpi_LIBADD = mpih-mul1.o \
mpih-mul2.o \
mpih-mul3.o \
mpih-add1.o \
mpih-sub1.o \
mpih-shift.o
mkinstalldirs = $(top_srcdir)/scripts/mkinstalldirs
CONFIG_HEADER = ../config.h
LIBRARIES = $(noinst_LIBRARIES)
@ -79,15 +89,15 @@ LIBS = @LIBS@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@
mpi_LIBADD =
mpi_OBJECTS = mpi-add.o mpi-bit.o mpi-cmp.o mpi-div.o mpi-gcd.o \
mpi-inv.o mpi-mul.o mpi-pow.o mpi-scan.o mpicoder.o mpihelp-add.o \
mpihelp-cmp.o mpihelp-div.o mpihelp-mul.o mpihelp-shift.o mpihelp-sub.o \
mpiutil.o
mpi-inv.o mpi-mul.o mpi-pow.o mpi-scan.o mpicoder.o mpih-cmp.o \
mpih-add.o mpih-sub.o mpih-div.o mpih-mul.o mpiutil.o
EXTRA_mpi_SOURCES =
LIBFILES = libmpi.a
AR = ar
RANLIB = @RANLIB@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
@ -105,10 +115,9 @@ $(srcdir)/.deps/mpi-cmp.P $(srcdir)/.deps/mpi-div.P \
$(srcdir)/.deps/mpi-gcd.P $(srcdir)/.deps/mpi-inv.P \
$(srcdir)/.deps/mpi-mul.P $(srcdir)/.deps/mpi-pow.P \
$(srcdir)/.deps/mpi-scan.P $(srcdir)/.deps/mpicoder.P \
$(srcdir)/.deps/mpihelp-add.P $(srcdir)/.deps/mpihelp-cmp.P \
$(srcdir)/.deps/mpihelp-div.P $(srcdir)/.deps/mpihelp-mul.P \
$(srcdir)/.deps/mpihelp-shift.P $(srcdir)/.deps/mpihelp-sub.P \
$(srcdir)/.deps/mpiutil.P
$(srcdir)/.deps/mpih-add.P $(srcdir)/.deps/mpih-cmp.P \
$(srcdir)/.deps/mpih-div.P $(srcdir)/.deps/mpih-mul.P \
$(srcdir)/.deps/mpih-sub.P $(srcdir)/.deps/mpiutil.P
SOURCES = $(mpi_SOURCES)
OBJECTS = $(mpi_OBJECTS)
@ -218,7 +227,7 @@ install: install-exec install-data all
uninstall:
all: $(LIBFILES) Makefile
all: $(LIBFILES) $(HEADERS) Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
@ -263,8 +272,17 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
CFLAGS += -O2
#mpi_DEPENDENCIES = mpih-mul1.S \
# mpih-mul2.S \
# mpih-mul3.S \
# mpih-add1.S \
# mpih-sub1.S \
# mpih-shift.S
#
.SUFFIXES:
.SUFFIXES: .c .o
.SUFFIXES: .c .o $(SUFFIXES)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -1,94 +0,0 @@
/* mpihelp-shift.c - MPI helper functions
* Copyright (c) 1997 by Werner Koch (dd9jn)
*
* This file is part of G10.
*
* G10 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* G10 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include "mpi-internal.h"
/* Shift U (pointed to by UP and USIZE digits long) CNT bits to the left
* and store the USIZE least significant digits of the result at WP.
* Return the bits shifted out from the most significant digit.
*
* Argument constraints:
* 1. 0 < CNT < BITS_PER_MP_LIMB
* 2. If the result is to be written over the input, WP must be >= UP.
*/
mpi_limb_t
mpihelp_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize,
unsigned int cnt)
{
mpi_limb_t high_limb, low_limb;
unsigned sh_1, sh_2;
mpi_size_t i;
mpi_limb_t retval;
sh_1 = cnt;
wp += 1;
sh_2 = BITS_PER_MPI_LIMB - sh_1;
i = usize - 1;
low_limb = up[i];
retval = low_limb >> sh_2;
high_limb = low_limb;
while( --i >= 0 ) {
low_limb = up[i];
wp[i] = (high_limb << sh_1) | (low_limb >> sh_2);
high_limb = low_limb;
}
wp[i] = high_limb << sh_1;
return retval;
}
/* Shift U (pointed to by UP and USIZE limbs long) CNT bits to the right
* and store the USIZE least significant limbs of the result at WP.
* The bits shifted out to the right are returned.
*
* Argument constraints:
* 1. 0 < CNT < BITS_PER_MP_LIMB
* 2. If the result is to be written over the input, WP must be <= UP.
*/
mpi_limb_t
mpihelp_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned cnt)
{
mpi_limb_t high_limb, low_limb;
unsigned sh_1, sh_2;
mpi_size_t i;
mpi_limb_t retval;
sh_1 = cnt;
wp -= 1;
sh_2 = BITS_PER_MPI_LIMB - sh_1;
high_limb = up[0];
retval = high_limb << sh_2;
low_limb = high_limb;
for( i=1; i < usize; i++) {
high_limb = up[i];
wp[i] = (low_limb >> sh_1) | (high_limb << sh_2);
low_limb = high_limb;
}
wp[i] = low_limb >> sh_1;
return retval;
}