bug-gmp
[Top][All Lists]
Advanced

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

Re: [Bug-gmp] tiny improvement


From: Torbjorn Granlund
Subject: Re: [Bug-gmp] tiny improvement
Date: 17 Oct 2000 22:30:08 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6

Holger Bettag <address@hidden> writes:

  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).
  
Thanks for the tuneup values for the G3/G4.
  
  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".
  
Does -mcpu=750 imply to generate powerpc code, or just tune for the
750?  The GCC default is to generate instructions that are available
on both old POWER and PowerPC.

  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.
  
The place to start is modifying the existing code and see if you can
make it faster.  I expect that to be hard to make great improvements,
the G3/G4 chips have poor integer multiply support, unlike the 604.

There are useful timing programs in mpn/tests.

If you want to tune (say) mpn_addmul_1, the do something like this:

$ gcc -O2 -mpowerpc -Ipath-to-sourcedir -Ipath-to-builddir 
...mpn/tests/addmul_1.c path-to-builddir/.libs/libgmp.a 
-DCLOOCK=<clock-in-hertz>
$ a.out

The SIZE and TIMES parametsr are also useful.  For testing
correctness, pass -DTIMES=1 and -DRANDOM when compiling.

  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.
  
If you write new, faster G3/G4 code, I can make the configuration
system choose the new code for these processors.

-- 
Torbjörn



reply via email to

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