View | Details | Raw Unified | Return to bug 179857
Collapse All | Expand All

(-)ieee-utils/fp-freebsd.c (-1 / +33 lines)
Lines 24-46 Link Here
24
int
24
int
25
gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
25
gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
26
{
26
{
27
#ifndef __ppc__
27
  fp_prec_t prec = 0 ;
28
  fp_prec_t prec = 0 ;
29
#endif
28
  fp_except_t mode = 0 ;
30
  fp_except_t mode = 0 ;
29
  fp_rnd_t    rnd  = 0 ;
31
  fp_rnd_t    rnd  = 0 ;
30
32
31
  switch (precision)
33
  switch (precision)
32
    {
34
    {
33
    case GSL_IEEE_SINGLE_PRECISION:
35
    case GSL_IEEE_SINGLE_PRECISION:
36
#ifdef __ppc__
37
      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
38
#else
34
      prec = FP_PS;
39
      prec = FP_PS;
35
      fpsetprec(prec);      
40
      fpsetprec(prec);      
41
#endif
36
      break ;
42
      break ;
37
    case GSL_IEEE_DOUBLE_PRECISION:
43
    case GSL_IEEE_DOUBLE_PRECISION:
44
#ifdef __ppc__
45
      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
46
#else
38
      prec = FP_PD;
47
      prec = FP_PD;
39
      fpsetprec(prec);
48
      fpsetprec(prec);
49
#endif
40
      break ;
50
      break ;
41
    case GSL_IEEE_EXTENDED_PRECISION:
51
    case GSL_IEEE_EXTENDED_PRECISION:
52
#ifdef __ppc__
53
      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
54
#else
42
      prec = FP_PE;
55
      prec = FP_PE;
43
      fpsetprec(prec);
56
      fpsetprec(prec);
57
#endif
44
      break ;
58
      break ;
45
    }
59
    }
46
60
Lines 69-81 Link Here
69
83
70
  /* Turn on all the exceptions apart from 'inexact' */
84
  /* Turn on all the exceptions apart from 'inexact' */
71
85
72
  mode = FP_X_INV | FP_X_DNML | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
86
  mode = FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
87
#ifndef __ppc__
88
  mode |= FP_X_DNML;
89
#endif
73
90
74
  if (exception_mask & GSL_IEEE_MASK_INVALID)
91
  if (exception_mask & GSL_IEEE_MASK_INVALID)
75
    mode &= ~ FP_X_INV ;
92
    mode &= ~ FP_X_INV ;
76
93
77
  if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
94
  if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
95
#ifdef __ppc__
96
    {
97
      /* Do nothing */
98
    }
99
  else
100
    {
101
      GSL_ERROR ("powerpc does not support the denormalized operand exception. "
102
                 "Use 'mask-denormalized' to work around this.", GSL_EUNSUP) ;
103
    }
104
#else
78
    mode &= ~ FP_X_DNML ;
105
    mode &= ~ FP_X_DNML ;
106
#endif
79
107
80
  if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
108
  if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
81
    mode &= ~ FP_X_DZ ;
109
    mode &= ~ FP_X_DZ ;
Lines 88-94 Link Here
88
116
89
  if (exception_mask & GSL_IEEE_TRAP_INEXACT)
117
  if (exception_mask & GSL_IEEE_TRAP_INEXACT)
90
    {
118
    {
119
#ifdef __ppc__
120
     GSL_ERROR ("powerpc does not support traps for inexact operations", GSL_EUNSUP) ;
121
#else
91
      mode |= FP_X_IMP ;
122
      mode |= FP_X_IMP ;
123
#endif
92
    }
124
    }
93
  else
125
  else
94
    {
126
    {

Return to bug 179857