From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93715 invoked by alias); 30 Sep 2015 12:49:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 93670 invoked by uid 48); 30 Sep 2015 12:49:39 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/67635] [SH] ifcvt missed optimization Date: Wed, 30 Sep 2015 12:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg02372.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67635 Oleg Endo changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyrylo.tkachov at arm dot com --- Comment #1 from Oleg Endo --- 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; }