From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3338 invoked by alias); 24 Nov 2014 05:39:05 -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 3131 invoked by uid 48); 24 Nov 2014 05:39:00 -0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/64015] [5.0 Regression] AArch64 ICE due to conditional compare Date: Mon, 24 Nov 2014 05:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: 2014-11/txt/msg02655.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64015 --- Comment #3 from Andrew Pinski --- (In reply to Zhenqiang Chen from comment #2) > 2) How to justify it is valueable (the overhead of ccmp is OK) when > generating ccmp? If we ignore the case for swapping. Try this one: int test (int a, int b) { return (a > 252) && b > 252; } With my patch to do the forcing: test: cmp w0, 252 mov w0, 252 ccmp w1, w0, 4, gt cset w0, gt ret Without: test: cmp w0, 252 cset w2, gt cmp w1, 252 cset w0, gt and w0, w2, w0 ret Or better yet take: int test (int a, int b) { return (a > 321223) && b > 321224; } Without: test: mov w3, 59079 mov w2, 59080 movk w3, 0x4, lsl 16 movk w2, 0x4, lsl 16 cmp w0, w3 cset w3, gt cmp w1, w2 cset w0, gt and w0, w3, w0 ret With forcing: test: mov w3, 59079 mov w2, 59080 movk w3, 0x4, lsl 16 movk w2, 0x4, lsl 16 cmp w0, w3 ccmp w1, w2, 4, gt cset w0, gt ret --- CUT --- Also take: int test (int a, int b) { return (a > 33) && b > 33; } Without: test: cmp w0, 33 cset w2, gt cmp w1, 33 cset w0, gt and w0, w2, w0 ret With forcing: test: cmp w0, 33 mov w0, 33 ccmp w1, w0, 4, gt cset w0, gt ret See how with forcing is always the same size or smaller?