libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / forwprop-28.c
blob4f88a2674b6590ec415c446b3e8e523af6e134c2
1 /* Setting LOGICAL_OP_NON_SHORT_CIRCUIT to 0 leads to two conditional jumps
2 when evaluating an && condition. VRP is not able to optimize this. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -fdump-tree-forwprop1-details --param logical-op-non-short-circuit=1" } */
6 extern char *frob (void);
7 extern _Bool testit (void);
8 extern void oof (void);
10 void
11 test (int code)
13 char *temp = frob ();
14 int rotate = (code == 22);
15 if (temp == 0 && !rotate)
16 oof ();
19 void
20 test_2 (int code)
22 char *temp = frob ();
23 int rotate = (code == 22);
24 if (!rotate && temp == 0)
25 oof ();
28 void
29 test_3 (int code)
31 char *temp = frob ();
32 int rotate = (code == 22);
33 if (!rotate || temp == 0)
34 oof ();
37 void
38 test_4 (int code)
40 char *temp = frob ();
41 int rotate = (code == 22);
42 if (temp == 0 || !rotate)
43 oof ();
46 void
47 test_5 (int code)
49 _Bool temp = testit ();
50 _Bool rotate = (code == 22);
51 if (temp == 0 && !rotate)
52 oof ();
55 void
56 test_6 (int code)
58 _Bool temp = testit ();
59 _Bool rotate = (code == 22);
60 if (!rotate && temp == 0)
61 oof ();
64 void
65 test_7 (int code)
67 _Bool temp = testit ();
68 _Bool rotate = (code == 22);
69 if (!rotate || temp == 0)
70 oof ();
73 void
74 test_8 (int code)
76 _Bool temp = testit ();
77 _Bool rotate = (code == 22);
78 if (temp == 0 || !rotate)
79 oof ();
82 /* ??? This used to check for 8 times transforming the combined conditional
83 to a ordered compare. But the transform does not trigger if we transform
84 the negated code == 22 compare to code != 22 first. It turns out if
85 we do that we even generate better code on x86 at least. */
86 /* ??? As PR71762 notices this transform causes wrong-code issues in RTL
87 with one uninitialized operand, thus it has been disabled. */
89 /* { dg-final { scan-tree-dump-times "simplified to if \\\(\[^ ]* \[<>\]" 4 "forwprop1" { xfail *-*-* } } } */