2018-01-24 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr66299-1.c
blobdf8476462f91f5154969f0b13155cec6019f92b4
1 /* PR tree-optimization/66299 */
2 /* { dg-do run } */
3 /* { dg-options "-fdump-tree-original" } */
4 /* { dg-require-effective-target int32plus } */
6 void
7 test1 (int x)
9 if ((0 << x) != 0
10 || (1 << x) != 2
11 || (2 << x) != 4
12 || (3 << x) != 6
13 || (4 << x) != 8
14 || (5 << x) != 10
15 || (6 << x) != 12
16 || (7 << x) != 14
17 || (8 << x) != 16
18 || (9 << x) != 18
19 || (10 << x) != 20)
20 __builtin_abort ();
23 void
24 test2 (int x)
26 if (!((0 << x) == 0
27 && (1 << x) == 4
28 && (2 << x) == 8
29 && (3 << x) == 12
30 && (4 << x) == 16
31 && (5 << x) == 20
32 && (6 << x) == 24
33 && (7 << x) == 28
34 && (8 << x) == 32
35 && (9 << x) == 36
36 && (10 << x) == 40))
37 __builtin_abort ();
40 void
41 test3 (unsigned int x)
43 if ((0U << x) != 0U
44 || (1U << x) != 16U
45 || (2U << x) != 32U
46 || (3U << x) != 48U
47 || (4U << x) != 64U
48 || (5U << x) != 80U
49 || (6U << x) != 96U
50 || (7U << x) != 112U
51 || (8U << x) != 128U
52 || (9U << x) != 144U
53 || (10U << x) != 160U)
54 __builtin_abort ();
57 void
58 test4 (unsigned int x)
60 if (!((0U << x) == 0U
61 || (1U << x) == 8U
62 || (2U << x) == 16U
63 || (3U << x) == 24U
64 || (4U << x) == 32U
65 || (5U << x) == 40U
66 || (6U << x) == 48U
67 || (7U << x) == 56U
68 || (8U << x) == 64U
69 || (9U << x) == 72U
70 || (10U << x) == 80U))
71 __builtin_abort ();
74 void
75 test5 (int x)
77 if ((0 << x) == 1
78 || (0 << x) != 0
79 || (0x8001U << x) != 0x20000U)
80 __builtin_abort ();
83 int
84 main (void)
86 test1 (1);
87 test2 (2);
88 test3 (4U);
89 test4 (3U);
90 test5 (17);
93 /* { dg-final { scan-tree-dump-not "<<" "original" } } */