bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] gsl on mactel


From: Charles Ballard
Subject: [Bug-gsl] gsl on mactel
Date: Mon, 13 Mar 2006 11:32:52 +0000

Dear All,

I am a newbie to this list, so please forgive me if the information is known.

I have been trying to compile gsl on a mactel box. As fp.c has nothing for this system I get

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -c fp.c -fno-common - DPIC -o .libs/fp.lo
fp-darwin.c: In function 'gsl_ieee_set_mode':
/usr/include/architecture/ppc/fp_regs.h:132: error: output constraint 0 must specify a single register
fp-darwin.c:95: confused by earlier errors, bailing out

Having a quick look in fpu.h there seems to be a fairly simple relationship with the old fp-darwin.c. make check run and passes all tests (but I do not know if it is being tested properly)

Charles Ballard


************************************************************************ *****************
#include <architecture/i386/fpu.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_errno.h>

int
gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
{
  fp_control_t fp_scr;

  switch (precision)
    {
    case GSL_IEEE_SINGLE_PRECISION:
GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
      break ;
    case GSL_IEEE_DOUBLE_PRECISION:
GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
      break ;
    case GSL_IEEE_EXTENDED_PRECISION:
GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
      break ;
    }

  switch (rounding)
    {
    case GSL_IEEE_ROUND_TO_NEAREST:
      fp_scr.rc = FP_RND_NEAR ;
      break ;
    case GSL_IEEE_ROUND_DOWN:
      fp_scr.rc = FP_RND_DOWN ;
      break ;
    case GSL_IEEE_ROUND_UP:
      fp_scr.rc = FP_RND_UP ;
      break ;
    case GSL_IEEE_ROUND_TO_ZERO:
      fp_scr.rc = FP_CHOP ;
      break ;
    default:
      fp_scr.rc = FP_RND_NEAR ;
    }


  /* Turn on all the exceptions apart from 'inexact' */
  /* I'm not sure what 'Turn on' means.              */
  /* I'm assuming that enable = 1 and disable = 0    */
  /* and that disable is what is wanted.             */

  if (exception_mask & GSL_IEEE_MASK_INVALID)
fp_scr.invalid = 0 ; //invalid bit: invalid op exception enable

  if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
    fp_scr.denorm = 0 ;

  if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
fp_scr.zdiv = 0 ; //zdiv bit: zero divide exception enable

  if (exception_mask & GSL_IEEE_MASK_OVERFLOW)
fp_scr.ovrfl = 0 ; //overflow bit: overflow exception enable

  if (exception_mask & GSL_IEEE_MASK_UNDERFLOW)
fp_scr.undfl = 0 ; //underflow bit: underflow exception enable

  if (exception_mask & GSL_IEEE_TRAP_INEXACT)
    {
fp_scr.precis = 1 ; //precis bit: inexact exception enable
    }
  else
    {
      fp_scr.precis = 1 ;
    }

  return GSL_SUCCESS ;

}





reply via email to

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