2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr66299-1.c
blobe75146bf3eb3bf87e31cd0bcf8a277d50c2b2e22
1 /* PR tree-optimization/66299 */
2 /* { dg-do run } */
3 /* { dg-options "-fdump-tree-original" } */
5 void
6 test1 (int x)
8 if ((0 << x) != 0
9 || (1 << x) != 2
10 || (2 << x) != 4
11 || (3 << x) != 6
12 || (4 << x) != 8
13 || (5 << x) != 10
14 || (6 << x) != 12
15 || (7 << x) != 14
16 || (8 << x) != 16
17 || (9 << x) != 18
18 || (10 << x) != 20)
19 __builtin_abort ();
22 void
23 test2 (int x)
25 if (!((0 << x) == 0
26 && (1 << x) == 4
27 && (2 << x) == 8
28 && (3 << x) == 12
29 && (4 << x) == 16
30 && (5 << x) == 20
31 && (6 << x) == 24
32 && (7 << x) == 28
33 && (8 << x) == 32
34 && (9 << x) == 36
35 && (10 << x) == 40))
36 __builtin_abort ();
39 void
40 test3 (unsigned int x)
42 if ((0U << x) != 0U
43 || (1U << x) != 16U
44 || (2U << x) != 32U
45 || (3U << x) != 48U
46 || (4U << x) != 64U
47 || (5U << x) != 80U
48 || (6U << x) != 96U
49 || (7U << x) != 112U
50 || (8U << x) != 128U
51 || (9U << x) != 144U
52 || (10U << x) != 160U)
53 __builtin_abort ();
56 void
57 test4 (unsigned int x)
59 if (!((0U << x) == 0U
60 || (1U << x) == 8U
61 || (2U << x) == 16U
62 || (3U << x) == 24U
63 || (4U << x) == 32U
64 || (5U << x) == 40U
65 || (6U << x) == 48U
66 || (7U << x) == 56U
67 || (8U << x) == 64U
68 || (9U << x) == 72U
69 || (10U << x) == 80U))
70 __builtin_abort ();
73 void
74 test5 (int x)
76 if ((0 << x) == 1
77 || (0 << x) != 0
78 || (0x8001U << x) != 0x20000U)
79 __builtin_abort ();
82 int
83 main (void)
85 test1 (1);
86 test2 (2);
87 test3 (4U);
88 test4 (3U);
89 test5 (17);
92 /* { dg-final { scan-tree-dump-not "<<" "original" } } */