Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 2013 01:55:13 GMT
From:      Justin Hibbits <jrh29@alumni.cwru.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/179857: Fix for math/gsl on PowerPC
Message-ID:  <201306230155.r5N1tDOf029628@oldred.freebsd.org>
Resent-Message-ID: <201306230200.r5N200t5060581@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         179857
>Category:       ports
>Synopsis:       Fix for math/gsl on PowerPC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 23 02:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Justin Hibbits
>Release:        10-CURRENT
>Organization:
>Environment:
FreeBSD narn.knownspace 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r251882M: Tue Jun 18 07:09:21 PDT 2013     chmeee@zhabar:/usr/home/chmeee/world/narn/powerpc.powerpc/usr/home/chmeee/freebsd/head/sys/NARN  powerpc
>Description:
math/gsl needs some changes to build on PowerPC.
>How-To-Repeat:
Build math/gsl on PowerPC
>Fix:
Patch attached.  It may not be completely correct, but it allows it to build.

Patch attached with submission follows:

--- ieee-utils/fp-freebsd.c.old	2013-06-22 10:07:01.000000000 -0700
+++ ieee-utils/fp-freebsd.c	2013-06-22 18:43:24.000000000 -0700
@@ -24,23 +24,37 @@
 int
 gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
 {
+#ifndef __ppc__
   fp_prec_t prec = 0 ;
+#endif
   fp_except_t mode = 0 ;
   fp_rnd_t    rnd  = 0 ;
 
   switch (precision)
     {
     case GSL_IEEE_SINGLE_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PS;
       fpsetprec(prec);      
+#endif
       break ;
     case GSL_IEEE_DOUBLE_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PD;
       fpsetprec(prec);
+#endif
       break ;
     case GSL_IEEE_EXTENDED_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PE;
       fpsetprec(prec);
+#endif
       break ;
     }
 
@@ -69,13 +83,27 @@
 
   /* Turn on all the exceptions apart from 'inexact' */
 
-  mode = FP_X_INV | FP_X_DNML | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
+  mode = FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
+#ifndef __ppc__
+  mode |= FP_X_DNML;
+#endif
 
   if (exception_mask & GSL_IEEE_MASK_INVALID)
     mode &= ~ FP_X_INV ;
 
   if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
+#ifdef __ppc__
+    {
+      /* Do nothing */
+    }
+  else
+    {
+      GSL_ERROR ("powerpc does not support the denormalized operand exception. "
+                 "Use 'mask-denormalized' to work around this.", GSL_EUNSUP) ;
+    }
+#else
     mode &= ~ FP_X_DNML ;
+#endif
 
   if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
     mode &= ~ FP_X_DZ ;
@@ -88,7 +116,11 @@
 
   if (exception_mask & GSL_IEEE_TRAP_INEXACT)
     {
+#ifdef __ppc__
+     GSL_ERROR ("powerpc does not support traps for inexact operations", GSL_EUNSUP) ;
+#else
       mode |= FP_X_IMP ;
+#endif
     }
   else
     {


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306230155.r5N1tDOf029628>