From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C597385843E; Tue, 5 Mar 2024 13:02:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C597385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709643723; bh=15jTSaWsGrq/HGT2u4pJZ9kUwpaUvT/+MuDpAZy5jcU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UoQe4n4ndkkEnFsND+ynRaKRaYMrPHueIaEHMXVl/BVbI0ZVyXqGQr2Pp1rxhxFys W3Rni+8Ex//EdpB3S0hikhhjB3qw+r6O/CVCE/v6pjxr6Dpoi4mOKKDj9moYQsCpX3 Pca0Jx6seSqEisIDcsvGcxgBFrT2VDy+0uzY+EOc= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114009] [11/12/13/14 Regression] Missed optimization: (!a) * a => 0 when a=(a/2)*2 Date: Tue, 05 Mar 2024 13:02: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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D114009 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Is the regression marker added for the r11-2550-gca2b8c082c4f16919071c9f8de8db0b33b54c405 change: movl %edi, %eax - xorl %edx, %edx + movl $0, %edx shrl $31, %eax addl %edi, %eax + addl $1, %edi andl $-2, %eax - sete %dl - imull %edx, %eax + cmpl $2, %edi + cmova %edx, %eax movl %eax, w(%rip) ret or for the r12-5392-g527e54a431473cc497204226a21f2831d2375e66 change: - movl %edi, %eax - movl $0, %edx - shrl $31, %eax - addl %edi, %eax - addl $1, %edi - andl $-2, %eax - cmpl $2, %edi - cmova %edx, %eax + leal 1(%rdi), %eax + movl %edi, %edx + cmpl $2, %eax + setbe %al + shrl $31, %edx + addl %edi, %edx + movzbl %al, %eax + sarl %edx + imull %edx, %eax + addl %eax, %eax or both? I don't think we ever optimized this without -fwrapv to just 0.=