From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 891393858D35; Thu, 3 Aug 2023 12:53:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 891393858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691067194; bh=Ug0r5FuJaOiEN7MIDfbvlUvI9n3lnjL+OGzheFXAxeA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CxfhjCnKYjj+Vbfms643kvDi2JBP2Gq4oJClV0Rr5K7rTO9xtv5TpyxMEii/6tVLm qKR6t4RZGZ9aSy+89AJK+enThSxPwD8reN+EYWh7puzcuw6BULjxu367T3+5HBta5q n8XAXdtxvYw+3X/6i/yHs9fprJFsSv0M6vc2SlaA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110838] [14 Regression] wrong code on x365-3.5, -O3, sign extraction Date: Thu, 03 Aug 2023 12:53:13 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110838 --- Comment #8 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:29370f1387274ad5a35a020db6a5d06c0324e6c1 commit r14-2952-g29370f1387274ad5a35a020db6a5d06c0324e6c1 Author: Richard Biener Date: Mon Jul 31 14:44:52 2023 +0200 tree-optimization/110838 - vectorization of widened shifts The following makes sure to limit the shift operand when vectorizing (short)((int)x >> 31) via (short)x >> 31 as the out of bounds shift operand otherwise invokes undefined behavior. When we determine whether we can demote the operand we know we at most shift in the sign bit so we can adjust the shift amount. Note this has the possibility of un-CSEing common shift operands as there's no good way to share pattern stmts between patterns. We'd have to separately pattern recognize the definition. PR tree-optimization/110838 * tree-vect-patterns.cc (vect_recog_over_widening_pattern): Adjust the shift operand of RSHIFT_EXPRs. * gcc.dg/torture/pr110838.c: New testcase.=