GNU MP - PPC 440 build observation
    morten simonsen 
    ms at protelevision.com
       
    Sat Nov 26 11:59:51 CET 2011
    
    
  
I have build GNU mp 5.0.2, cross-compiling for PPC on an Intel machine, with 
the following command:
  sudo ./configure CC="/opt/eldk41/usr/bin/ppc_4xx-gcc" --host=none
  make
  make check
The following program (pseudo-excerpt as much of it relates to a pool of 
initialized mpf_t's - used as local variables in functions):
#include <gmp.h>
void function(const double *x, const double *y) {
  mpf_t *kw = (mpf_t*) malloc(2*sizeof(mpf_t));
  mpf_t *a  = &(kw[0]);
  mpf_t *b  = &(kw[1]);
  int   i;
  mpf_init(*a);
  mpf_init(*b);
  for(i=0;i<100;i++) {
  
    mpf_set_d(*a,*x);
    // different stuff
  }
  for(i=0;i<100;i++) {
  
    mpf_set_d(*a,*y);
    // different stuff
  }
  mpf_free(*a);
  mpf_free(*b);
  free(kw);
}
main() {
  double x = 1.;
  double y = 0.21;
  
  mpf_set_default_prec(128);
  function(&x,&y);
}
I observe that the first mpf_set_d-assignments to *a does not give *a the value 
of *x, but the the mpf_set_d-assignments in the second for loop does indeed 
give *a the values of *y. *a is used for further calculations in both for 
loops, hence I do not think that it is compiler optimization.
I use the same code on a intel host environment where it runss as expected - 
might this be an crosscomnpiling issue?
I do not have much experience (yet) with the GNU MP, but it has been very 
useful on my host - now I just wish to run it on my embedded PPC target.
Anyone having similar experience - and solutions?
Thanks & BR Morten
P.S. tuneup crashes on the target (regretfully I can not build tune on my host 
(linker can not find libgmp.la)
    
    
More information about the gmp-discuss
mailing list