From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18334 invoked by alias); 8 Jan 2015 11:04:18 -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 18287 invoked by uid 48); 8 Jan 2015 11:04:13 -0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59354] Element swizzling produces invalid result with -O3 (tree-cunrolli pass problem?) Date: Thu, 08 Jan 2015 11:04: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-Version: 4.8.2 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com 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: component short_desc 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-SW-Source: 2015-01/txt/msg00445.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59354 Uro=C5=A1 Bizjak changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |tree-optimization Summary|Unexpected result in g++ |Element swizzling produces |when casting int to char |invalid result with -O3 |from an stl vector to an |(tree-cunrolli pass |array |problem?) --- Comment #3 from Uro=C5=A1 Bizjak --- It looks to me that cunrolli pass is messing up element swizzling code. bisection-friendly C testcase: --cut here-- void abort (void); unsigned int a[256]; unsigned char b[256]; int main() { int i, z, x, y; for(i =3D 0; i < 256; i++) a[i] =3D i % 5; for (z =3D 0; z < 16; z++) for (y =3D 0; y < 4; y++) for (x =3D 0; x < 4; x++) b[y*64 + z*4 + x] =3D a[z*16 + y*4 + x]; if (b[4] !=3D 1) abort (); return 0; } --cut here-- gcc-5 on x86_64-linux-gnu with the above testcase: ~/gcc-build/gcc/cc1 -O3 pr59354.c Aborted ~/gcc-build/gcc/cc1 -O3 -fdisable-tree-cunrolli pr59354.c OK "Working" code produces following array: Breakpoint 1, main () at pr59354.c:18 18 if (b[4] !=3D 1) (gdb) p b $1 =3D "\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\0= 01\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\= 000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001= \004\000\001\002\000\001\002\003\004\000\001\002\000\001\002\003\001\002\00= 3\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\0= 02\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\= 001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\003\004\000= \001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\00= 4\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\0= 03\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\= 000\003\004\000\001\002\003\004\000\003\004\000\001"... (gdb) while "non-working" produces: (gdb) p b $1 =3D "\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\0= 03\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\= 002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000= \001\002\003\004\000\001\002\003\004\000\001\002\000\001\002\003\001\002\00= 3\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\0= 02\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\= 001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\003\004\000= \001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\00= 4\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\0= 03\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\= 000\003\004\000\001", '\000' (gdb) >>From gcc-bugs-return-472452-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 08 11:08:33 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 21051 invoked by alias); 8 Jan 2015 11:08:33 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 20462 invoked by uid 55); 8 Jan 2015 11:08:27 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55212] [SH] Switch to LRA Date: Thu, 08 Jan 2015 11:08: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: unknown 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: 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-01/txt/msg00446.txt.bz2 Content-length: 468 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55212 --- Comment #93 from Oleg Endo --- Author: olegendo Date: Thu Jan 8 11:07:45 2015 New Revision: 219341 URL: https://gcc.gnu.org/viewcvs?rev=219341&root=gcc&view=rev Log: gcc/ PR target/55212 * config/sh/sh.md (*addsi3_compact): Emit reg-reg copy instead of constant load if constant operand fits into I08. Modified: trunk/gcc/ChangeLog trunk/gcc/config/sh/sh.md