bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gmp] tiny improvement


From: Holger Bettag
Subject: [Bug-gmp] tiny improvement
Date: 14 Aug 2000 11:30:00 +0200

To whom it may concern,

I made a minor "improvement" to GMP for PowerPC G3/G4 platforms. After I
found out that all powerpc32 code is tuned for the 604, and exhibits horrible
stalls on 603/G3/G4, I re-ran tuneup on my powerpc-unknown-linux box (a
PowerMac G4, 500MHz).

Here's "gmp-mparam.PPC7400.h":

----------------------------- snip -----------------------------
/* gmp-mparam.h -- Compiler/machine parameter header file.

Copyright (C) 1991, 1993, 1994, 1999, 2000 Free Software Foundation, Inc.

This file is part of the GNU MP Library.

The GNU MP Library is free software; you can redistribute it and/or modify
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.

The GNU MP Library 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 Lesser General Public
License for more details.

You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */

#define BITS_PER_MP_LIMB 32
#define BYTES_PER_MP_LIMB 4
#define BITS_PER_LONGINT 32
#define BITS_PER_INT 32
#define BITS_PER_SHORTINT 16
#define BITS_PER_CHAR 8

/* These values are for the 7400.  Presumably, these should be very
   similar for the 750 and even the 603 as those have identical multiplier
   implementations. */

/* Generated by tuneup.c, 2000-08-14. */

#ifndef KARATSUBA_MUL_THRESHOLD
#define KARATSUBA_MUL_THRESHOLD     10
#endif
#ifndef TOOM3_MUL_THRESHOLD
#define TOOM3_MUL_THRESHOLD        141
#endif

#ifndef KARATSUBA_SQR_THRESHOLD
#define KARATSUBA_SQR_THRESHOLD     22
#endif
#ifndef TOOM3_SQR_THRESHOLD
#define TOOM3_SQR_THRESHOLD        130
#endif

#ifndef BZ_THRESHOLD
#define BZ_THRESHOLD                31
#endif

#ifndef FIB_THRESHOLD
#define FIB_THRESHOLD               82
#endif

#ifndef POWM_THRESHOLD
#define POWM_THRESHOLD              10
#endif

#ifndef GCD_ACCEL_THRESHOLD
#define GCD_ACCEL_THRESHOLD          4
#endif
#ifndef GCDEXT_THRESHOLD
#define GCDEXT_THRESHOLD            62
#endif
----------------------------- snip -----------------------------

The values differ significantly from those tuned for the
604. Furthermore, I found that only rather few PowerPC specific
assembly routines are present, so I configured with CFLAGS="-O2
-mcpu=750".

I'd be interested in writing PPC G3/G4 code for GMP, but I don't know
where to start. For one, I didn't directly program PPC assembly so
far. I have all the architecture docs and user manuals for the various
PPC chips, but in the past I only looked at gcc-generated assembly and
tweaked it. I know nothing about ABI considerations and could need
some quick and dirty rules, e.g. when to save which registers and
where. The currently present PPC asm routines don't comment on that.

Secondly, I'd like to subdivide the powerpc directory into
machine-specific subdirectories, but I don't understand the GMP build
process well enough to do that. Fiddling with the current powerpc32
directory would only reduce performance on the 604.

I will subscribe to the GMP mailinglist immediately.

  Holger


reply via email to

[Prev in Thread] Current Thread [Next in Thread]