This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix final bits of PR28796


On Tue, 24 Oct 2006, Richard Guenther wrote:

> On Mon, 23 Oct 2006, Roger Sayle wrote:
> 
> > 
> > On Sat, 21 Oct 2006, Richard Guenther wrote:
> > > 2006-08-25  Richard Guenther  <rguenther@suse.de>
> > >
> > > 	PR middle-end/28796
> > > 	* builtins.c (fold_builtin_classify): Use HONOR_INFINITIES
> > > 	and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS
> > > 	for deciding optimizations in consistency with fold-const.c
> > > 	(fold_builtin_unordered_cmp): Likewise.
> > 
> > :REVIEWMAIL:
> > 
> > This is OK for mainline.  Now that everything is nicely consistent,
> > would it be possible to add some tests to the testsuite to ensure
> > that we do the correct folding with different command line options?
> 
> I will try to come up with something that hopefully works on all
> targets (fingers crossing...).

I have added the following:

/* { dg-do link } */
/* { dg-options "-ffinite-math-only" } */

float f;

int main()
{
  if (__builtin_isunordered (f, f) != 0)
    link_error ();
  if (__builtin_isnan (f) != 0)
    link_error ();
  if (__builtin_finite (f) != 1)
    link_error ();
  if (f != f)
    link_error ();
  return 0;
}


/* { dg-do run } */
/* { dg-options "-O2 -funsafe-math-optimizations" } */

extern void abort (void);

void foo(float f)
{
  if (__builtin_isunordered (f, f) != 1)
    abort ();
  if (__builtin_isnan (f) != 1)
    abort ();
  if (__builtin_finite (f) != 0)
    abort ();
}

int main()
{
  float f = __builtin_nanf("");
  foo(f);
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]