From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 234333858002; Thu, 15 Jun 2023 02:13:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 234333858002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686795185; bh=ZgeUryEIqPlZspyRhjwIU8DfS+oEDUBtAEYMJmPebxM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VHoMFB0feUeznZegjp1+X1xJnr6/rKXz4mdmgWPC0JEmV7ZGpO+yhsAS9XorEx3OG 84rkgu55NDSqVJ5grNzeJdhSqpBty/6ZNCL9UQPVemGrxx1F04FOINmvxhOppbRk6F /iUKxMq1FzrOIcN/UToZOUpwqIdCPxYIfJgGwG0Q= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110252] [14 Regression] Wrong code at -O2/3/s on x86_64-linux-gnu Date: Thu, 15 Jun 2023 02:13: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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D110252 --- Comment #3 from Andrew Pinski --- smallest testcase: ``` signed char f() __attribute__((__noipa__)); signed char f() { return 0; } int main() { int g =3D f() - 1; int e =3D g < 0 ? 1 : ((g >> (8-2))!=3D0); asm("":"+r"(e)); if (e !=3D 1) __builtin_abort(); } ``` Note I changed 6 to 8-2 as it better explains what is going on and why 6 is= the one needed here. Second the 239 is just changed over to -1 as it just needs any subtraction. third is j is inlined and the !=3D is moved over to the conditional express= ion. 4th and not least, removed all of the pointers and just changed over to usi= ng inline-asm to hide the range of e at the if statement.=