From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 942 invoked by alias); 2 Nov 2012 17:05:35 -0000 Received: (qmail 719 invoked by uid 48); 2 Nov 2012 17:05:05 -0000 From: "dwmw2 at infradead dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/55177] missed optimizations with __builtin_bswap Date: Fri, 02 Nov 2012 17:05: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-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dwmw2 at infradead dot 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: 2012-11/txt/msg00169.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55177 --- Comment #3 from David Woodhouse 2012-11-02 17:05:03 UTC --- The first example isn't *that* dumb, as a cut-down test case of real code which may look more complex in reality. If the real code really *is* as simple as my test case, you're right that perhaps we *could* optimise it ourselves by eschewing the normal accessor macros for explicit-endian values, and manually byteswapping the constant instead. But really, we shouldn't *have* to. The compiler can see what's happening, and it can deal with it a whole lot better than we can, especially when it comes to loads and stores. Your argument applies just as well to the second test case. I could just byteswap the constant instead of the variable. But still I shouldn't have to.