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 { target { ! { logical_op_short_circuit || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* } } } } } */ 4 /* { dg-options "-O2 -fdump-tree-forwprop1-details" } */ 5 6 extern char *frob (void); 7 extern _Bool testit (void); 8 extern void oof (void); 9 10 void test(int code)11test (int code) 12 { 13 char *temp = frob (); 14 int rotate = (code == 22); 15 if (temp == 0 && !rotate) 16 oof (); 17 } 18 19 void test_2(int code)20test_2 (int code) 21 { 22 char *temp = frob (); 23 int rotate = (code == 22); 24 if (!rotate && temp == 0) 25 oof (); 26 } 27 28 void test_3(int code)29test_3 (int code) 30 { 31 char *temp = frob (); 32 int rotate = (code == 22); 33 if (!rotate || temp == 0) 34 oof (); 35 } 36 37 void test_4(int code)38test_4 (int code) 39 { 40 char *temp = frob (); 41 int rotate = (code == 22); 42 if (temp == 0 || !rotate) 43 oof (); 44 } 45 46 void test_5(int code)47test_5 (int code) 48 { 49 _Bool temp = testit (); 50 _Bool rotate = (code == 22); 51 if (temp == 0 && !rotate) 52 oof (); 53 } 54 55 void test_6(int code)56test_6 (int code) 57 { 58 _Bool temp = testit (); 59 _Bool rotate = (code == 22); 60 if (!rotate && temp == 0) 61 oof (); 62 } 63 64 void test_7(int code)65test_7 (int code) 66 { 67 _Bool temp = testit (); 68 _Bool rotate = (code == 22); 69 if (!rotate || temp == 0) 70 oof (); 71 } 72 73 void test_8(int code)74test_8 (int code) 75 { 76 _Bool temp = testit (); 77 _Bool rotate = (code == 22); 78 if (temp == 0 || !rotate) 79 oof (); 80 } 81 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. */ 88 89 /* { dg-final { scan-tree-dump-times "simplified to if \\\(\[^ ]* \[<>\]" 4 "forwprop1" { xfail *-*-* } } } */ 90 91