From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 13F273857C56; Wed, 5 Jan 2022 23:28:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13F273857C56 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/43311] missed 'movw' optimization. Date: Wed, 05 Jan 2022 23:28:05 +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.4.3 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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: cf_gcchost cf_gccbuild Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2022 23:28:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D43311 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Host|x86_64-gnu-linux | Build|x86_64-gnu-linux | --- Comment #7 from Andrew Pinski --- (In reply to Zdenek Sojka from comment #5) > (In reply to comment #4) > >=20 > > No, s.b2 should be 1. >=20 > Thank you for the answer. In that case, the optimisation in comment #0 ca= n't > be done in a general case (unless I have overlooked something). Right this makes the code wrong if we do this, an aliasing issue.=20 But this is well defined to do: typedef struct { unsigned char b1, b2; } __attribute__((aligned(8))) S; void f( S const* __restrict__ s, unsigned char* __restrict__ b1, unsigned c= har* __restrict__ b2 ) { *b1 =3D s->b1; *b2 =3D s->b2; }=