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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -fdump-tree-switchconv" } */
3
/* { dg-do run } */
4
 
5
extern void abort (void);
6
 
7
static int X, Y;
8
 
9
int check(int param)
10
{
11
  int a = 0;
12
  int b = 1;
13
 
14
  switch (param)
15
    {
16
    case -2:
17
      a = 0;
18
      b = -1;
19
      break;
20
    case 1:
21
    case 2:
22
      a = 8;
23
      b = 6;
24
      break;
25
    case 3:
26
      a = 9;
27
      b = 5;
28
      break;
29
    case 6:
30
      a = 10;
31
      b = 4;
32
      break;
33
    default:
34
      a = 16;
35
      b = 1;
36
    }
37
 
38
  X = a;
39
  Y = b;
40
  return 0;
41
}
42
 
43
void assertions(int a, int b)
44
{
45
  if (X != a || Y != b)
46
    abort();
47
 
48
  return;
49
}
50
 
51
int main ()
52
{
53
  check (-10);
54
  assertions (16, 1);
55
 
56
  check (-2);
57
  assertions (0, -1);
58
 
59
  check(1);
60
  assertions (8, 6);
61
 
62
  check(2);
63
  assertions (8, 6);
64
 
65
  check(3);
66
  assertions (9, 5);
67
 
68
  check(5);
69
  assertions (16, 1);
70
 
71
  check(6);
72
  assertions (10, 4);
73
 
74
  check(12);
75
  assertions (16, 1);
76
 
77
  return 0;
78
}
79
 
80
/* { dg-final { scan-tree-dump "Switch converted" "switchconv" } } */
81
/* { dg-final { cleanup-tree-dump "switchconv" } } */

powered by: WebSVN 2.1.0

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