comparison gcc/testsuite/gcc.dg/20150120-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 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-original" } */
3
4 /* x + (x & 1) -> (x + 1) & ~1 */
5 int
6 fn1 (int x)
7 {
8 return x + (x & 1);
9 }
10 int
11 fn2 (int x)
12 {
13 return (x & 1) + x;
14 }
15 int
16 fn3 (int x)
17 {
18 return x + (1 & x);
19 }
20 int
21 fn4 (int x)
22 {
23 return (1 & x) + x;
24 }
25 unsigned int
26 fn5 (unsigned int x)
27 {
28 return x + (x & 1);
29 }
30 unsigned int
31 fn6 (unsigned int x)
32 {
33 return (x & 1) + x;
34 }
35 unsigned int
36 fn7 (unsigned int x)
37 {
38 return x + (x % 2);
39 }
40 unsigned int
41 fn8 (unsigned int x)
42 {
43 return (x % 2) + x;
44 }
45 unsigned int
46 fn9 (unsigned int x)
47 {
48 return (1LL & x) + x;
49 }
50
51 /* { dg-final { scan-tree-dump-times "x \\+ 1" 9 "original" } } */