OSDN Git Service

2012-01-03 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr46309.c
1 /* PR tree-optimization/46309 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-reassoc-details" } */
4 /* The transformation depends on BRANCH_COST being greater than 1
5    (see the notes in the PR), so try to force that.  */
6 /* { dg-additional-options "-mtune=octeon2" { target mips*-*-* } } */
7
8 int
9 f1 (int a)
10 {
11   int v1 = (a == 3);
12   int v2 = (a == 1);
13   int v3 = (a == 4);
14   int v4 = (a == 2);
15   return v1 || v2 || v3 || v4;
16 }
17
18 int
19 f2 (int a)
20 {
21   int v1 = (a == 1);
22   int v2 = (a == 2);
23   int v3 = (a == 3);
24   int v4 = (a == 4);
25   return v1 || v2 || v3 || v4;
26 }
27
28 int
29 f3 (int a)
30 {
31   int v1 = (a == 3);
32   int v2 = (a == 1);
33   return v1 || v2;
34 }
35
36 int
37 f4 (int a)
38 {
39   int v1 = (a == 1);
40   int v2 = (a == 2);
41   return v1 || v2;
42 }
43
44 int
45 f5 (unsigned int a)
46 {
47   int v1 = (a <= 31);
48   int v2 = (a >= 64 && a <= 95);
49   return v1 || v2;
50 }
51
52 int
53 f6 (unsigned int a)
54 {
55   int v1 = (a <= 31);
56   int v2 = (a >= 64 && a <= 95);
57   int v3 = (a >= 128 && a <= 159);
58   int v4 = (a >= 192 && a <= 223);
59   return v1 || v2 || v3 || v4;
60 }
61
62 /* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.2, 2. and -.3, 3. and -.4, 4.\[\n\r\]* into" 2 "reassoc1" } } */
63 /* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.3, 3.\[\n\r\]* into" 1 "reassoc1" } } */
64 /* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.2, 2.\[\n\r\]* into" 1 "reassoc1" } } */
65 /* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.0, 31. and -.64, 95.\[\n\r\]* into" 2 "reassoc1" } } */
66 /* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.128, 159. and -.192, 223.\[\n\r\]* into" 1 "reassoc1" } } */
67 /* { dg-final { scan-tree-dump-times "Optimizing range tests D.\[0-9\]*_\[0-9\]* -.0, 31. and -.128, 159.\[\n\r\]* into" 1 "reassoc2" } } */
68 /* { dg-final { cleanup-tree-dump "reassoc1" } } */
69 /* { dg-final { cleanup-tree-dump "reassoc2" } } */