From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24491 invoked by alias); 12 Nov 2014 23:25:30 -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 24442 invoked by uid 48); 12 Nov 2014 23:25:26 -0000 From: "gcc-bugzilla at mkarcher dot dialup.fu-berlin.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63783] [4.9/5 Regression] [SH] Miscompilation of boolean negation on SH4 using -O2 Date: Wed, 12 Nov 2014 23:25: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: 4.9.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc-bugzilla at mkarcher dot dialup.fu-berlin.de X-Bugzilla-Status: NEW 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 attachments.created 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/msg01056.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63783 Michael Karcher changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gcc-bugzilla at mkarcher dot dialu | |p.fu-berlin.de --- Comment #3 from Michael Karcher --- Created attachment 33954 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33954&action=edit Remove assumption that "not" is logical negate Indeed the treg combine pass is broken. Thanks to the nicely documented code, it could easily be determined, that this optimization pass contains the wrong assumption that "not" is an assembler instruction that can be used for logical negation of a register. As this is a bitwise negate instruction, it can not be used that way. As I was unable to find a machine instruction that performs logical negation, I prepared a patch that completely removes the parts that rely on a logical negate instruction, while keeping all other aspects on the optimization pass intact.