From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 88AA73858D33; Thu, 6 Jul 2023 16:32:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88AA73858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688661123; bh=XW29n9+pRkcKiIA4L9QMT4pauzSD+U6m60R0oQSd0XQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sV1Q/rI4pDwgDJhUdRjCthenMy/nsPFVTY17FThxgepCZkHd7lEUzOCrjXVWhEod+ 9QuZUIfo/d9sXiX9MAZia+ldlDUqggjEeLknePxKrSqn/jJ5s4fCMTLXD2doJ2iWRb fBG3FrRLX3bEUfaK163kW+LlusBOnVoWInPydt+c= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110557] [13/14 Regression] Wrong code for x86_64-linux-gnu with -O3 -mavx2: vectorized loop mishandles signed bit-fields Date: Thu, 06 Jul 2023 16:32:03 +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: patch, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: xry111 at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D110557 --- Comment #6 from Xi Ruoyao --- (In reply to avieira from comment #5) > Hi Xi, >=20 > Feel free to test your patch and submit it to the list for review. I had a > look over and it looks correct to me. https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623782.html The changes from the version posted here: 1. Add a test case (I already made it sandwiched because a very first, not posted version of the patch failed with sandwiched cases). 2. Slightly adjusted the comment. There is another issue: if mask_width + shift_n =3D=3D prec, we should omit= the AND_EXPR even for unsigned bit-field. For example movq $-256, %rax vmovq %rax, %xmm1 vpunpcklqdq %xmm1, %xmm1, %xmm1 vpand (%rcx,%rdi,8), %xmm1, %xmm1 vpsrlq $8, %xmm1, %xmm1 can be just vmovdqu (%rcx,%rdi,8), %xmm1 vpsrlq $8, %xmm1, %xmm1 But it's a different issue so we can fix it in a different patch.=