From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31169 invoked by alias); 12 Feb 2013 13:26:29 -0000 Received: (qmail 30580 invoked by uid 48); 12 Feb 2013 13:26:00 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/56175] Issue with combine phase on x86. Date: Tue, 12 Feb 2013 13:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-02/txt/msg01180.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56175 --- Comment #8 from Richard Biener 2013-02-12 13:25:59 UTC --- (In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > This pattern is already recognized by simplify_bitwise_binary but only for > > > usual int type, i.e. if we change all short types to the ordinary int (or > > > unsigned) this simplification takes place (dump after 1st forwprop): > > > > > > : > > > x_8 = x_2(D) >> 1; > > > y_9 = y_4(D) >> 1; > > > _10 = x_8 & 1; > > > _11 = y_9 & 1; > > > _16 = x_8 ^ y_9; > > > z_12 = _16 & 1; > > > > > > i.e. the issue is redundant type conversions: > > > > > > : > > > x_7 = x_2(D) >> 1; > > > y_8 = y_4(D) >> 1; > > > _13 = x_7 & 1; > > > _9 = (signed char) _13; > > > _14 = y_8 & 1; > > > _10 = (signed char) _14; > > > _11 = _9 ^ _10; > > > > > > I assume that if we delete these redundant conversions the required > > > simplification will happen. > > > > Ah, well. The issue is that we transformed (unsigned char)y & 1 > > to (unsigned char)(y & 1). > > Hi Richard, > > We'd like to fix this issue since we can get +10.5% speedup on Atom. > What is your opinion on how better to fix this issue with 1st pattern in > simplify_bitwise_binary? > > I have no idea why gcc does such transformation and what gain we can get from > it - decrease size of constant or create more opportunities for cse? Well, you'd have to track down what is responsible for that transform. Generally promoting operations (and automatic vars) to word-mode may be beneficial on most targets. But that should be done late. > I can propose the following possible changes: > > 1. Introduce a hook for doing such transformation. > 2. Introduce a new forwprop pass that does not do such transformation. > 3. Do not perform such transformation for small positive constant. > 4. Do not performa such transformation if (type-x) c == c. > etc. First track it down ;) > Any help will be appreciated. > Yuri.