On Fri, 23 Dec 2011, Richard Guenther wrote:

> On Thu, 22 Dec 2011, Richard Henderson wrote:
> 
> > On 12/22/2011 07:46 AM, Richard Guenther wrote:
> > > Any way to test, in the testcase, whether the vector modes
> > > will have NaNs or not?
> > 
> >  v[0] != v[0] ?
> 
> Well, if MODE_HAS_NANS returns false we might fold 0.0/0.0 to 0.0,
> or the HW might simply not have NaNs (SPU?) and have 0.0 as the
> result.  Thus, I want to query GCC capabilities (-ffinite-math-only)
> and HW capabilities (what we have in real_mode_format) from inside
> the testcase.
> 
> Any idea?  Otherwise I'll add dg-skips for the targets that fail
> the test.

It seems we have __<type>_HAS_QUIET_NAN__.  Nice.  Thus I'll use

/* { dg-do run } */

extern void abort (void);
typedef float vf128 __attribute__((vector_size(16)));
typedef float vf64 __attribute__((vector_size(8)));
int main()
{
#if !__FINITE_MATH_ONLY__
#if __FLT_HAS_QUIET_NAN__
  vf128 v = (vf128){ 0.f, 0.f, 0.f, 0.f };
  vf64 u = (vf64){ 0.f, 0.f };
  v = v / (vf128){ 0.f, 0.f, 0.f, 0.f };
  if (v[0] == v[0])
    abort ();
  u = u / (vf64){ 0.f, 0.f };
  if (u[0] == u[0])
    abort ();
#endif
#endif
  return 0;
}

Reply via email to