From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95BCF384AB41; Wed, 10 Apr 2024 20:49:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95BCF384AB41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712782169; bh=DVcXicMDHypBfDf9RiYG2lBefPS+aKshHN6KeUrkvW8=; h=From:To:Subject:Date:From; b=B4gZSXTeOIshdcFA27t77Z84oo7Pgy2sEj/FKWpUb2d1/xgSB6oGAqAUMqDxE0DWk 0yPKlJo2owsM2YZe8mvOZdwG4XpNtKNc6rz0yz5rt8OIC9lk8RzaO/kakcTQyUsmPh TMDwPo+nPGSu2vpB4WLIwZdLqvCdJ2x7IDrqam4c= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114684] New: `-(int)(unsigned:1)signed:1` could just be `(int)signed:1` Date: Wed, 10 Apr 2024 20:49:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D114684 Bug ID: 114684 Summary: `-(int)(unsigned:1)signed:1` could just be `(int)signed:1` Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` struct t{ signed s1 : 1; unsigned u1 : 1; } b =3D {-1}; int f() { struct t tt =3D b; return tt.s1; } int f1() { struct t tt =3D b; tt.u1 =3D tt.s1; int ttt =3D tt.u1; return -ttt; } ``` These 2 functions should produce the same code. (For aarch64 it almost does, there is an extra sign extend in f). I noticed this while fixing PR 114666.= It is also related to PR 101955. Note this only works for 1bit signed values.=