From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 13AF23858C2C; Tue, 4 Jan 2022 21:44:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13AF23858C2C From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103905] [12 Regression] Miscompiled i386-expand.c with -march=bdver1 and -O3 since r12-1789-g836328b2c99f5b8d Date: Tue, 04 Jan 2022 21:44:07 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Tue, 04 Jan 2022 21:44:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103905 --- Comment #6 from Uro=C5=A1 Bizjak --- @Jakub: It looks the problem is in expand_vec_perm_pshufb, where permutation vector is recalculated for partial vectors: if (vmode =3D=3D V4QImode || vmode =3D=3D V8QImode) { rtx m128 =3D GEN_INT (-128); /* Remap elements from the second operand, as we have to account for inactive top elements from the first operand. */ if (!d->one_operand_p) { int sz =3D GET_MODE_SIZE (vmode); for (i =3D 0; i < nelt; ++i) { int ival =3D INTVAL (rperm[i]); if (ival >=3D sz) ival +=3D 16-sz; rperm[i] =3D GEN_INT (ival); } } /* V4QI/V8QI is emulated with V16QI instruction, fill inactive elements in the top positions with zeros. */ for (i =3D nelt; i < 16; ++i) rperm[i] =3D m128; vpmode =3D V16QImode; } I must admit I only eyeballed the generated code, so perhaps there lies the dragon.=