Debian Codegraph @

gcc/testsuite/gcc.dg/fold-mul-and-lshift-1.c

raw
1 /* { dg-do compile { target lp64 } } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* { dg-final { scan-tree-dump-not { >> } "optimized" } } */
4 /* { dg-final { scan-tree-dump-not { \* } "optimized" } } */
5
6 unsigned int
7 f1 (unsigned int x)
8 {
9 x >>= 1;
10 unsigned long y = x;
11 y &= 255;
12 x = y;
13 x *= 2;
14 return x;
15 }
16
17 unsigned int
18 f2 (unsigned int x)
19 {
20 x >>= 1;
21 unsigned long y = x;
22 y &= -2UL;
23 x = y;
24 x *= 2;
25 return x;
26 }
27
28 unsigned int
29 f3 (unsigned int x)
30 {
31 x >>= 1;
32 unsigned short y = x;
33 y &= 255;
34 x = y;
35 x *= 2;
36 return x;
37 }
38
39 unsigned int
40 f4 (unsigned int x)
41 {
42 x >>= 1;
43 short y = x;
44 y &= (unsigned short) ~0U >> 1;
45 x = y;
46 x *= 2;
47 return x;
48 }
49
50 unsigned int
51 f5 (unsigned int x)
52 {
53 x >>= 16;
54 short y = x;
55 y &= -2;
56 x = y;
57 x *= 1 << 16;
58 return x;
59 }