blob: 51b79f7839b5735220a545733020773191f3e821 (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* PR tree-optimization/9814 */
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort(void);
int test1(int x)
{
if (x & 2)
x |= 2;
return x;
}
int test2(int x)
{
if (!(x & 2))
x |= 2;
return x;
}
int test3(int x)
{
if (x & 2)
x ^= 2;
return x;
}
int test4(int x)
{
if (!(x & 2))
x ^= 2;
return x;
}
int test5(int x)
{
if (x & 2)
x &= ~2;
return x;
}
int test6(int x)
{
if (!(x & 2))
x &= ~2;
return x;
}
int main()
{
if (test1(0) != 0)
abort();
if (test1(2) != 2)
abort();
if (test1(5) != 5)
abort();
if (test1(7) != 7)
abort();
if (test2(0) != 2)
abort();
if (test2(2) != 2)
abort();
if (test2(5) != 7)
abort();
if (test2(7) != 7)
abort();
if (test3(0) != 0)
abort();
if (test3(2) != 0)
abort();
if (test3(5) != 5)
abort();
if (test3(7) != 5)
abort();
if (test4(0) != 2)
abort();
if (test4(2) != 2)
abort();
if (test4(5) != 7)
abort();
if (test4(7) != 7)
abort();
if (test5(0) != 0)
abort();
if (test5(2) != 0)
abort();
if (test5(5) != 5)
abort();
if (test5(7) != 5)
abort();
if (test6(0) != 0)
abort();
if (test6(2) != 2)
abort();
if (test6(5) != 5)
abort();
if (test6(7) != 7)
abort();
return 0;
}
|