Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/pr9814-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* PR tree-optimization/9814 */ | |
2 /* { dg-do run } */ | |
3 /* { dg-options "-O2" } */ | |
4 | |
5 extern void abort(void); | |
6 | |
7 int test1(int x) | |
8 { | |
9 if (x & 2) | |
10 x |= 2; | |
11 return x; | |
12 } | |
13 | |
14 int test2(int x) | |
15 { | |
16 if (!(x & 2)) | |
17 x |= 2; | |
18 return x; | |
19 } | |
20 | |
21 int test3(int x) | |
22 { | |
23 if (x & 2) | |
24 x ^= 2; | |
25 return x; | |
26 } | |
27 | |
28 int test4(int x) | |
29 { | |
30 if (!(x & 2)) | |
31 x ^= 2; | |
32 return x; | |
33 } | |
34 | |
35 int test5(int x) | |
36 { | |
37 if (x & 2) | |
38 x &= ~2; | |
39 return x; | |
40 } | |
41 | |
42 int test6(int x) | |
43 { | |
44 if (!(x & 2)) | |
45 x &= ~2; | |
46 return x; | |
47 } | |
48 | |
49 int main() | |
50 { | |
51 if (test1(0) != 0) | |
52 abort(); | |
53 if (test1(2) != 2) | |
54 abort(); | |
55 if (test1(5) != 5) | |
56 abort(); | |
57 if (test1(7) != 7) | |
58 abort(); | |
59 | |
60 if (test2(0) != 2) | |
61 abort(); | |
62 if (test2(2) != 2) | |
63 abort(); | |
64 if (test2(5) != 7) | |
65 abort(); | |
66 if (test2(7) != 7) | |
67 abort(); | |
68 | |
69 if (test3(0) != 0) | |
70 abort(); | |
71 if (test3(2) != 0) | |
72 abort(); | |
73 if (test3(5) != 5) | |
74 abort(); | |
75 if (test3(7) != 5) | |
76 abort(); | |
77 | |
78 if (test4(0) != 2) | |
79 abort(); | |
80 if (test4(2) != 2) | |
81 abort(); | |
82 if (test4(5) != 7) | |
83 abort(); | |
84 if (test4(7) != 7) | |
85 abort(); | |
86 | |
87 if (test5(0) != 0) | |
88 abort(); | |
89 if (test5(2) != 0) | |
90 abort(); | |
91 if (test5(5) != 5) | |
92 abort(); | |
93 if (test5(7) != 5) | |
94 abort(); | |
95 | |
96 if (test6(0) != 0) | |
97 abort(); | |
98 if (test6(2) != 2) | |
99 abort(); | |
100 if (test6(5) != 5) | |
101 abort(); | |
102 if (test6(7) != 7) | |
103 abort(); | |
104 | |
105 return 0; | |
106 } | |
107 |