bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'fpieee'


From: Bruno Haible
Subject: Re: new module 'fpieee'
Date: Mon, 26 Mar 2007 02:37:23 +0200
User-agent: KMail/1.5.4

Ben Pfaff wrote:
> Is this also necessary on SH systems?  The GCC manual has this in
> the page specific to SH:
> 
>     `-mieee'
>          Increase IEEE-compliance of floating-point code.  At the moment,
>          this is equivalent to `-fno-finite-math-only'.  When generating 16
>          bit SH opcodes, getting IEEE-conforming results for comparisons of
>          NANs / infinities incurs extra overhead in every floating point
>          comparison, therefore the default is set to `-ffinite-math-only'.

Indeed, this appears to be the same issue: generation of NaN and Inf
results. I'm applying the appended patch. Thanks!

> In GNU PSPP, I have a configure test that just checks whether the
> compiler accepts -mieee and uses it if it is available.

Hmm, I'm not a fan of throwing particular options at any compiler, without
having looked at the effects. For example, the option stuck into LDFLAGS
by m4/lib-ignore.m4 leads to a bold warning every time a program is linked
on IRIX.

> I wonder whether this is an approach that is more likely to automatically
> work as architectures appear.

My favourite approach for coping with new architectures is to write tests.
This will catch the expected and unexpected portability problems. Whereas the
approach of trying GCC options at random will catch only portability problems
that you have encountered in the past, not the new ones.

Bruno

*** m4/fpieee.m4        26 Mar 2007 00:16:46 -0000      1.2
--- m4/fpieee.m4        26 Mar 2007 00:28:05 -0000
***************
*** 26,33 ****
  [
    AC_REQUIRE([AC_PROG_CC])
    AC_REQUIRE([AC_CANONICAL_HOST])
!   # IEEE behaviour is the default on all CPUs except Alpha
!   # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4).
    case "$host_cpu" in
      alpha*)
        # On Alpha systems, a compiler option provides the behaviour.
--- 26,34 ----
  [
    AC_REQUIRE([AC_PROG_CC])
    AC_REQUIRE([AC_CANONICAL_HOST])
!   # IEEE behaviour is the default on all CPUs except Alpha and SH
!   # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
!   # and the GCC 4.1.2 manual).
    case "$host_cpu" in
      alpha*)
        # On Alpha systems, a compiler option provides the behaviour.
***************
*** 41,45 ****
--- 42,52 ----
          CPPFLAGS="$CPPFLAGS -ieee"
        fi
        ;;
+     sh*)
+       if test -n "$GCC"; then
+         # GCC has the option -mieee.
+         CPPFLAGS="$CPPFLAGS -mieee"
+       fi
+       ;;
    esac
  ])





reply via email to

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