OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [vrp62.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -fno-tree-ccp -fno-tree-dominator-opts" } */
3
 
4
/* Tests generated via  */
5
 
6
#if 0
7
#include <stdio.h>
8
int main(int argc, char **argv)
9
{
10
  int amin, amax, bmin, bmax, a, b;
11
  int testno = 0;
12
  int min = atoi (argv[1]);
13
  int max = atoi (argv[2]);
14
  char op = argv[3][0];
15
  printf ("/* Testing range [%d, %d] with operator %c.  */\n", min, max, op);
16
  printf ("extern void abort (void);\n");
17
  for (amin = min; amin <= max; ++amin)
18
    for (amax = amin; amax <= max; ++amax)
19
      for (bmin = min; bmin <= max; ++bmin)
20
        for (bmax = bmin; bmax <= max; ++bmax)
21
          {
22
            ++testno;
23
            printf ("int test%d (int a, int b)\n"
24
                    "{\n"
25
                    "  if (a >= %d && a <= %d && b >= %d && b <= %d)\n"
26
                    "   {\n"
27
                    "      int x = a %c b;\n"
28
                    "      if (0\n", testno, amin, amax, bmin, bmax, op);
29
            for (a = amin; a <= amax; ++a)
30
              for (b = bmin; b <= bmax; ++b)
31
                printf ("|| x == (%d %c %d)\n", a, op, b);
32
            printf ("         ) return 0;\n"
33
                    "      abort ();\n"
34
                    "   }\n"
35
                    "  return 0;\n"
36
                    "}\n");
37
          }
38
  printf ("int main()\n"
39
          "{\n"
40
          "  int a, b;\n"
41
          "  for (a = %d; a <= %d; ++a)\n"
42
          "    for (b = %d; b <= %d; ++b)\n"
43
          "      {\n", min, max, min, max);
44
  for (; testno > 0; --testno)
45
    printf ("      test%d (a, b);\n", testno);
46
  printf ("      }\n"
47
          "  return 0;\n"
48
          "}\n");
49
  return 0;
50
}
51
#endif
52
 
53
extern void abort (void);
54
 
55
int test381 (int a, int b)
56
{
57
  if (a >= -3 && a <= -1 && b >= -2 && b <= 3)
58
    {
59
      int x = a | b;
60
      if (x == (-3 | -2)
61
          || x == (-3 | -1)
62
          || x == (-3 | 0)
63
          || x == (-3 | 1)
64
          || x == (-3 | 2)
65
          || x == (-3 | 3)
66
          || x == (-2 | -2)
67
          || x == (-2 | -1)
68
          || x == (-2 | 0)
69
          || x == (-2 | 1)
70
          || x == (-2 | 2)
71
          || x == (-2 | 3)
72
          || x == (-1 | -2)
73
          || x == (-1 | -1)
74
          || x == (-1 | 0)
75
          || x == (-1 | 1)
76
          || x == (-1 | 2)
77
          || x == (-1 | 3))
78
        return 0;
79
      abort ();
80
    }
81
  return 0;
82
}
83
 
84
int test900 (int a, int b)
85
{
86
  if (a >= -1 && a <= 2 && b >= 3 && b <= 3)
87
    {
88
      int x = a & b;
89
      if (x == (-1 & 3)
90
          || x == (0 & 3)
91
          || x == (1 & 3)
92
          || x == (2 & 3))
93
        return 0;
94
      abort ();
95
    }
96
  return 0;
97
}
98
 
99
int main()
100
{
101
  int a, b;
102
  for (a = -4; a < 4; ++a)
103
    for (b = -4; b < 4; ++b)
104
      {
105
        test381 (a, b);
106
        test900 (a, b);
107
      }
108
 
109
  return 0;
110
}

powered by: WebSVN 2.1.0

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