OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [cdce3.C] - Diff between revs 301 and 384

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 384
/* { dg-do run } */
/* { dg-do run } */
/* { dg-require-effective-target c99_runtime } */
/* { dg-require-effective-target c99_runtime } */
/* { dg-skip-if "exp2* missing despite C99 runtime" { alpha*-dec-osf5* } } */
/* { dg-skip-if "exp2* missing despite C99 runtime" { alpha*-dec-osf5* } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
/* { dg-add-options ieee } */
/* { dg-add-options ieee } */
/* { dg-final { scan-tree-dump  "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
/* { dg-final { scan-tree-dump  "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
/* { dg-final { scan-tree-dump  "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
/* { dg-final { scan-tree-dump  "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
/* { dg-final { scan-tree-dump  "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:101: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:101: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:102: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:102: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:103: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:103: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:104: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:104: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:109: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump  "cdce3.C:109: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
#include 
#include 
#include 
#include 
#ifdef DEBUG
#ifdef DEBUG
#include 
#include 
#endif
#endif
#include 
#include 
typedef void (*FP) (int xp);
typedef void (*FP) (int xp);
#define NI __attribute__((noinline))
#define NI __attribute__((noinline))
#if defined(LARGE_LONG_DOUBLE)
#if defined(LARGE_LONG_DOUBLE)
typedef long double ldouble;
typedef long double ldouble;
ldouble result;
ldouble result;
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
{ \
{ \
  float yy = name##f ((float) x); \
  float yy = name##f ((float) x); \
  STORE_RESULT; \
  STORE_RESULT; \
} \
} \
NI void prefix##name (int x) \
NI void prefix##name (int x) \
{ \
{ \
  double yy = name ((double)x); \
  double yy = name ((double)x); \
  STORE_RESULT; \
  STORE_RESULT; \
} \
} \
NI void prefix##name##l (int x) \
NI void prefix##name##l (int x) \
{ \
{ \
  ldouble yy = name##l ((ldouble)x); \
  ldouble yy = name##l ((ldouble)x); \
  STORE_RESULT; \
  STORE_RESULT; \
}
}
#else
#else
double result;
double result;
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
{ \
{ \
  float yy = name##f ((float) x); \
  float yy = name##f ((float) x); \
  STORE_RESULT; \
  STORE_RESULT; \
} \
} \
NI void prefix##name (int x) \
NI void prefix##name (int x) \
{ \
{ \
  double yy = name ((double)x); \
  double yy = name ((double)x); \
  STORE_RESULT; \
  STORE_RESULT; \
}
}
#endif
#endif
#undef STORE_RESULT
#undef STORE_RESULT
#define STORE_RESULT result = yy
#define STORE_RESULT result = yy
#if defined(GNU_EXTENSION)
#if defined(GNU_EXTENSION)
DEF_MATH_FUNC (m,pow10)
DEF_MATH_FUNC (m,pow10)
DEF_MATH_FUNC (m,exp10)
DEF_MATH_FUNC (m,exp10)
#endif
#endif
DEF_MATH_FUNC (m,exp2)
DEF_MATH_FUNC (m,exp2)
DEF_MATH_FUNC (m,exp)
DEF_MATH_FUNC (m,exp)
DEF_MATH_FUNC (m,expm1)
DEF_MATH_FUNC (m,expm1)
DEF_MATH_FUNC (m,cosh)
DEF_MATH_FUNC (m,cosh)
DEF_MATH_FUNC (m,sinh)
DEF_MATH_FUNC (m,sinh)
DEF_MATH_FUNC (m,acos)
DEF_MATH_FUNC (m,acos)
DEF_MATH_FUNC (m,asin)
DEF_MATH_FUNC (m,asin)
DEF_MATH_FUNC (m,acosh)
DEF_MATH_FUNC (m,acosh)
DEF_MATH_FUNC (m,atanh)
DEF_MATH_FUNC (m,atanh)
DEF_MATH_FUNC (m,log)
DEF_MATH_FUNC (m,log)
DEF_MATH_FUNC (m,log2)
DEF_MATH_FUNC (m,log2)
DEF_MATH_FUNC (m,log10)
DEF_MATH_FUNC (m,log10)
DEF_MATH_FUNC (m,log1p)
DEF_MATH_FUNC (m,log1p)
DEF_MATH_FUNC (m,sqrt)
DEF_MATH_FUNC (m,sqrt)
#undef STORE_RESULT
#undef STORE_RESULT
#define STORE_RESULT
#define STORE_RESULT
#if defined(GNU_EXTENSION)
#if defined(GNU_EXTENSION)
DEF_MATH_FUNC (o,pow10)
DEF_MATH_FUNC (o,pow10)
DEF_MATH_FUNC (o,exp10)
DEF_MATH_FUNC (o,exp10)
#endif
#endif
DEF_MATH_FUNC (o,exp2)
DEF_MATH_FUNC (o,exp2)
DEF_MATH_FUNC (o,exp)
DEF_MATH_FUNC (o,exp)
DEF_MATH_FUNC (o,expm1)
DEF_MATH_FUNC (o,expm1)
DEF_MATH_FUNC (o,cosh)
DEF_MATH_FUNC (o,cosh)
DEF_MATH_FUNC (o,sinh)
DEF_MATH_FUNC (o,sinh)
DEF_MATH_FUNC (o,acos)
DEF_MATH_FUNC (o,acos)
DEF_MATH_FUNC (o,asin)
DEF_MATH_FUNC (o,asin)
DEF_MATH_FUNC (o,acosh)
DEF_MATH_FUNC (o,acosh)
DEF_MATH_FUNC (o,atanh)
DEF_MATH_FUNC (o,atanh)
DEF_MATH_FUNC (o,log)
DEF_MATH_FUNC (o,log)
DEF_MATH_FUNC (o,log2)
DEF_MATH_FUNC (o,log2)
DEF_MATH_FUNC (o,log10)
DEF_MATH_FUNC (o,log10)
DEF_MATH_FUNC (o,log1p)
DEF_MATH_FUNC (o,log1p)
DEF_MATH_FUNC (o,sqrt)
DEF_MATH_FUNC (o,sqrt)
#if defined(LARGE_LONG_DOUBLE)
#if defined(LARGE_LONG_DOUBLE)
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
{ prefix##name, #name, 0, 0, lb, ub }, \
{ prefix##name, #name, 0, 0, lb, ub }, \
{ prefix##name##l, #name "l" , 0, 0, lb, ub },
{ prefix##name##l, #name "l" , 0, 0, lb, ub },
#else
#else
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
{ prefix##name, #name, 0, 0, lb, ub },
{ prefix##name, #name, 0, 0, lb, ub },
#endif
#endif
struct MathFuncInfo
struct MathFuncInfo
{
{
  FP math_func;
  FP math_func;
  const char*  name;
  const char*  name;
  int lb;
  int lb;
  int ub;
  int ub;
  bool has_lb;
  bool has_lb;
  bool has_ub;
  bool has_ub;
} math_func_arr[] = {
} math_func_arr[] = {
#if defined(GNU_EXTENSION)
#if defined(GNU_EXTENSION)
  INIT_MATH_FUNC (m,pow10, false, true)
  INIT_MATH_FUNC (m,pow10, false, true)
  INIT_MATH_FUNC (m,exp10, false, true)
  INIT_MATH_FUNC (m,exp10, false, true)
#endif
#endif
  INIT_MATH_FUNC (m,exp2, false, true)
  INIT_MATH_FUNC (m,exp2, false, true)
  INIT_MATH_FUNC (m,expm1, false, true)
  INIT_MATH_FUNC (m,expm1, false, true)
  INIT_MATH_FUNC (m,exp, false, true)
  INIT_MATH_FUNC (m,exp, false, true)
  INIT_MATH_FUNC (m,cosh, true, true)
  INIT_MATH_FUNC (m,cosh, true, true)
  INIT_MATH_FUNC (m,sinh, true, true)
  INIT_MATH_FUNC (m,sinh, true, true)
  INIT_MATH_FUNC (m,acos, true, true)
  INIT_MATH_FUNC (m,acos, true, true)
  INIT_MATH_FUNC (m,asin, true, true)
  INIT_MATH_FUNC (m,asin, true, true)
  INIT_MATH_FUNC (m,acosh, true, false)
  INIT_MATH_FUNC (m,acosh, true, false)
  INIT_MATH_FUNC (m,atanh, true, true)
  INIT_MATH_FUNC (m,atanh, true, true)
  INIT_MATH_FUNC (m,log10, true, false)
  INIT_MATH_FUNC (m,log10, true, false)
  INIT_MATH_FUNC (m,log, true, false)
  INIT_MATH_FUNC (m,log, true, false)
  INIT_MATH_FUNC (m,log2, true, false)
  INIT_MATH_FUNC (m,log2, true, false)
  INIT_MATH_FUNC (m,log1p, true, false)
  INIT_MATH_FUNC (m,log1p, true, false)
  INIT_MATH_FUNC (m,sqrt, true, false)
  INIT_MATH_FUNC (m,sqrt, true, false)
  { 0, 0,  0, 0, 0, 0} };
  { 0, 0,  0, 0, 0, 0} };
MathFuncInfo opt_math_func_arr[] =
MathFuncInfo opt_math_func_arr[] =
{
{
#if defined(GNU_EXTENSION)
#if defined(GNU_EXTENSION)
  INIT_MATH_FUNC (o,pow10, false, true)
  INIT_MATH_FUNC (o,pow10, false, true)
  INIT_MATH_FUNC (o,exp10, false, true)
  INIT_MATH_FUNC (o,exp10, false, true)
#endif
#endif
  INIT_MATH_FUNC (o,exp2, false, true)
  INIT_MATH_FUNC (o,exp2, false, true)
  INIT_MATH_FUNC (o,expm1, false, true)
  INIT_MATH_FUNC (o,expm1, false, true)
  INIT_MATH_FUNC (o,exp, false, true)
  INIT_MATH_FUNC (o,exp, false, true)
  INIT_MATH_FUNC (o,cosh, true, true)
  INIT_MATH_FUNC (o,cosh, true, true)
  INIT_MATH_FUNC (o,sinh, true, true)
  INIT_MATH_FUNC (o,sinh, true, true)
  INIT_MATH_FUNC (o,acos, true, true)
  INIT_MATH_FUNC (o,acos, true, true)
  INIT_MATH_FUNC (o,asin, true, true)
  INIT_MATH_FUNC (o,asin, true, true)
  INIT_MATH_FUNC (o,acosh, true, false)
  INIT_MATH_FUNC (o,acosh, true, false)
  INIT_MATH_FUNC (o,atanh, true, true)
  INIT_MATH_FUNC (o,atanh, true, true)
  INIT_MATH_FUNC (o,log10, true, false)
  INIT_MATH_FUNC (o,log10, true, false)
  INIT_MATH_FUNC (o,log, true, false)
  INIT_MATH_FUNC (o,log, true, false)
  INIT_MATH_FUNC (o,log2, true, false)
  INIT_MATH_FUNC (o,log2, true, false)
  INIT_MATH_FUNC (o,log1p, true, false)
  INIT_MATH_FUNC (o,log1p, true, false)
  INIT_MATH_FUNC (o,sqrt, true, false)
  INIT_MATH_FUNC (o,sqrt, true, false)
  { 0, 0,  0, 0, 0, 0} };
  { 0, 0,  0, 0, 0, 0} };
int test (MathFuncInfo* math_func_infos)
int test (MathFuncInfo* math_func_infos)
{
{
  int i = 0;
  int i = 0;
  int te = 0;
  int te = 0;
  for (i = 0; math_func_infos[i].math_func; i++)
  for (i = 0; math_func_infos[i].math_func; i++)
    {
    {
      MathFuncInfo& info = math_func_infos[i];
      MathFuncInfo& info = math_func_infos[i];
      int j;
      int j;
      if (info.has_lb)
      if (info.has_lb)
        {
        {
          for (j = 0; j > -500000; j--)
          for (j = 0; j > -500000; j--)
            {
            {
              errno = 0;
              errno = 0;
              info.math_func (j);
              info.math_func (j);
              if (errno != 0)
              if (errno != 0)
                {
                {
                  te++;
                  te++;
                  info.lb = j ;
                  info.lb = j ;
                  break;
                  break;
                }
                }
            }
            }
        }
        }
      if (info.has_ub)
      if (info.has_ub)
        {
        {
          for (j = 0; j < 500000; j++)
          for (j = 0; j < 500000; j++)
            {
            {
              errno = 0;
              errno = 0;
              info.math_func (j);
              info.math_func (j);
              if (errno != 0)
              if (errno != 0)
              {
              {
                te++;
                te++;
                info.ub = j ;
                info.ub = j ;
                break;
                break;
              }
              }
            }
            }
        }
        }
    }
    }
  return te;
  return te;
}
}
int main()
int main()
{
{
   int te1, te2;
   int te1, te2;
   te1 = test (&math_func_arr[0]);
   te1 = test (&math_func_arr[0]);
   te2 = test (&opt_math_func_arr[0]);
   te2 = test (&opt_math_func_arr[0]);
   // Now examine the result
   // Now examine the result
   int i = 0;
   int i = 0;
   int errcnt = 0;
   int errcnt = 0;
   for (i = 0; math_func_arr[i].math_func; i++)
   for (i = 0; math_func_arr[i].math_func; i++)
   {
   {
      MathFuncInfo& info = math_func_arr[i];
      MathFuncInfo& info = math_func_arr[i];
      MathFuncInfo& opt_info = opt_math_func_arr[i];
      MathFuncInfo& opt_info = opt_math_func_arr[i];
#ifdef DEBUG
#ifdef DEBUG
      fprintf (stderr," %s: lb = %d, ub = %d: lb_opt = %d, ub_opt = %d\n",
      fprintf (stderr," %s: lb = %d, ub = %d: lb_opt = %d, ub_opt = %d\n",
        info.name, info.lb, info.ub, opt_info.lb, opt_info.ub);
        info.name, info.lb, info.ub, opt_info.lb, opt_info.ub);
#endif
#endif
      if (info.lb != opt_info.lb) errcnt ++;
      if (info.lb != opt_info.lb) errcnt ++;
      if (info.ub != opt_info.ub) errcnt ++;
      if (info.ub != opt_info.ub) errcnt ++;
   }
   }
   if (errcnt) abort();
   if (errcnt) abort();
   return 0;
   return 0;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.