* the options given when GCC was configured/built;

Configured with: /home/niva/src/gcc-3.4-binutils/configure
--with-headers=/home/vxuser/oc2000/mips/src/include
--without-libs --enable-generated-files-in-srcdir
--enable-threads=posix -with-dwarf2 --disable-shared
--target=mips64-none-elf --verbose --enable-checking
--enable-languages=c --srcdir=/home/niva/svnwork/src
--prefix=/home/niva/local --enable-cpp

     * the complete command line that triggers the bug;

 mips64-none-elf-gcc-3.4.3 -mips3 -O3 -S fp-cmp.c -o fp-cmp-mips3.s

     * the compiler output (error messages, warnings, etc.);

No error messages

     * the  preprocessed  file (*.i*) 


void
test_isunordered(double x, double y, int true)
{
  if (__builtin_isunordered(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}

void
test_isless(double x, double y, int true)
{
  if (__builtin_isless(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}

void
test_islessequal(double x, double y, int true)
{
  if (__builtin_islessequal(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}

void
test_isgreater(double x, double y, int true)
{
  if (__builtin_isgreater(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}

void
test_isgreaterequal(double x, double y, int true)
{
  if (__builtin_isgreaterequal(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}

void
test_islessgreater(double x, double y, int true)
{
  if (__builtin_islessgreater(x, y))
    {
      if (! true)
        abort ();
    }
  else
    {
      if (true)
        abort ();
    }
}


     *  The functions __builtin_isless, __builtin_islessequal 
        are implemented via mips instructions c.lt.d, c.le.d that 
        raise the 'invalid' floating-point exception when the operands 
         are unordered.
      
        This contradicts to ISO/IEC 9899:1999 specification of the
        'isless' and 'islessequal' functions:

        "The isless macro determines whether its first argument is less than its
        second argument. The value of isless(x, y) is always equal to (x) < (y);
        however, unlike (x) < (y), isless(x, y) does not raise the 
&#8216;&#8216;invalid&#8217;&#8217; 
        floating-point exception when x and y are unordered."
        
        Likewise for 'islessequal'. "

        Note that __builtin_isgreater,
       __builtin_isgreaterequal are implemented via c.ule.d, c.ult.d
       that do not raise the exception.

-- 
           Summary: wrong code for __builtin_isless, __builtin_islessequal
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: niva at niisi dot msk dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mips64-none-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21416

Reply via email to