https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67635
Oleg Endo <olegendo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyrylo.tkachov at arm dot com --- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> --- Here are some more missed ifcvt cases. I haven't done any analysis what's happening, just dumping them here for later. When compiling those cases, they result in conditional branches, although they could be done without. I ran into these when adding the addsicc pattern to SH (PR 54236 attachment 36012). However, I haven't committed the actual addsicc part, because it doesn't seem to do anything on SH. Kyrill, maybe some of those cases could be interesting for you, since you've been doing some ifcvt work recently. // this is a GCC 6 regression. it works on GCC 5 // if "y != x" is changed to "y == x" it also works. int test_01_3 (int x, int y) { if (y != x) ++x; return x; /* GCC 5: cmp/eq r4,r5 mov #-1,r1 mov r4,r0 rts subc r1,r0 */ } // another GCC 6 regression. works on GCC 5 int test_01_5 (int x, float y, float z) { if (y >= z) ++x; return x; } /* good: fpchg fcmp/gt fr4,fr5 mov #0,r0 bt .L6 fcmp/eq fr4,fr5 .L6: addc r4,r0 << expected addc fpchg rts nop */ int test_00 (int x, int y) { return x == 0 ? 1 : x; } int test_00_1 (int x, int y) { return x ? x += 1 : x; } unsigned int test_02 (unsigned int x) { return x == 0 ? x + 1 : x; // will not use addcc in ifcvt } int test_02 (int x) { return x == 0 ? x + 1 : x; // will not use addc } // doesn't work with unsigned int, but ... unsigned int test_03 (unsigned int x) { return x > 0 ? x + 1 : x; } // ... works with signed int (in pr54236-5.c) int test_05_3 (int x) { return x > 0 ? x + 1 : x; } int test_05_1 (int x) { return x != 0 ? x + 1 : x; } int test_05_2 (int x) { return x == 0 ? x + 1 : x; } unsigned int check_0 (unsigned int x) { return x == 0 ? 1 : x; } unsigned int test_130 (unsigned int x) { return x != 0 ? (x - 1) : x; } unsigned int test_101 (unsigned int x, unsigned int y) { return x == y ? 1 : x; } unsigned int test_102 (unsigned int x) { return x == 3 ? 1 : x; }