bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'fpieee'


From: Ben Pfaff
Subject: Re: new module 'fpieee'
Date: Sun, 25 Mar 2007 17:08:18 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> The code needed for isnan() needs to construct a NaN or Inf object. But
> doing so leads to a SIGFPE by default on Alpha systems. There's only one
> way to get IEEE compliant behaviour of elementary arithmetic operations on
> this platform: instruct the compiler to emit different (more expensive)
> floating-point instructions. This module implements it.

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'.

In GNU PSPP, I have a configure test that just checks whether the
compiler accepts -mieee and uses it if it is available.  I wonder
whether this is an approach that is more likely to automatically
work as architectures appear.

Here's what PSPP is using:

    dnl Check whether a C compiler option is accepted.
    dnl If so, add it to CFLAGS.
    dnl Example: PSPP_ENABLE_OPTION(-Wdeclaration-after-statement)
    AC_DEFUN([PSPP_ENABLE_OPTION],
    [
      m4_define([pspp_cv_name], [pspp_cv_[]m4_translit([$1], [-], [_])])dnl
      AC_CACHE_CHECK([whether $CC accepts $1], [pspp_cv_name], 
        [pspp_save_CFLAGS="$CFLAGS"
         CFLAGS="$CFLAGS $1"
         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [pspp_cv_name[]=yes], 
[pspp_cv_name[]=no])
         CFLAGS="$pspp_save_CFLAGS"])
      if test $pspp_cv_name = yes; then
        CFLAGS="$CFLAGS $1"
      fi
    ])

...

    PSPP_ENABLE_OPTION(-mieee)
-- 
Only wimps use tape backup: _real_ men just upload their important stuff
on ftp, and let the rest of the world mirror it ;)
        -- Linus Torvalds





reply via email to

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