aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/switch-5.c
blob: b05742cf153cc083edc2f0bd262a96b7434352b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* { dg-do compile { target { { x86_64-*-* aarch64-*-* ia64-*-* powerpc64-*-* } && lp64 } } } */
/* { dg-options "-O2 -fdump-tree-switchlower1" } */

int f0();    
int f1();    
int f2();    
int f3();    
int f4();    
     
int foo(int a)    
{    
    switch (a)    
    {    
        case 0:    
        case 2:    
        case 4:    
        case 6:    
            return f0();    
        case 8:    
            return f1();    
        case 10:    
        case 14:    
        case 16:    
        case 18:    
            return f2();    
        case 12:    
            return f3();    
        case 20:    
            return f4();    
    }    
    return -1;    
}

/* { dg-final { scan-tree-dump ";; GIMPLE switch case clusters: BT:0-8 BT:10-20" "switchlower1" } } */

int bar(int a)    
{    
    switch (a)    
    {    
        case 20:    
        case 18:    
        case 16:    
        case 14:    
            return f0();    
        case 12:    
            return f1();    
        case 10:    
        case 6:    
        case 4:    
        case 2:    
            return f2();    
        case 8:    
            return f3();    
        case 0:    
            return f4();    
    }    
    return -1;    
}

/* { dg-final { scan-tree-dump ";; GIMPLE switch case clusters: BT:0-10 BT:12-20" "switchlower1" } } */