From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23412 invoked by alias); 22 Feb 2015 12:56:36 -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 23374 invoked by uid 48); 22 Feb 2015 12:56:31 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65162] [5 Regression][SH] Redundant tests when storing bswapped T bit result in unaligned mem Date: Sun, 22 Feb 2015 13:04: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: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo 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-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed 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-02/txt/msg02421.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65162 Oleg Endo changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-02-22 Ever confirmed|0 |1 --- Comment #1 from Oleg Endo --- (In reply to Oleg Endo from comment #0) > The following example is taken from libav, which contains quite some uses of > this code pattern. > > typedef unsigned short int uint16_t; > union unaligned_16 { uint16_t l; } __attribute__((packed)); > > int > test (unsigned char* buf, int bits_per_component) > { > (((union unaligned_16 *)(buf))->l) = > __builtin_bswap16 (bits_per_component == 10 ? 1 : 0); > > return 0; > } > BTW, it should actually translate to something like: mov r6,r0 cmp/eq #10,r0 movt r0 mov.b r0,@(1,r4) mov #0,r0 rts mov.b r0,@r4 or mov r6,r0 cmp/eq #10,r0 movt r0 mov.b r0,@(1,r4) shlr8 r0 rts mov.b r0,@r4