From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9E5F43858409; Fri, 21 Jul 2023 16:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E5F43858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689957968; bh=MwnXfkJQUJB95/CDF4mPTIc+8FXgzM4q27MShNKdciY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=We4ApJpnPzaHe0xkw9ebVRBIDlyxOLhtqX7kOeI4x+ScyYVD5LF4JnEnrmU711rp2 aD1/r8i4EUlm/QdGKo9pE6D/hcCc7U0QAxB2k1y3rZe+xFpzK1LGOY1n7l1Pk0K1P3 OBrucB0XTOZZBj450T1smqwc94Q+7yKTHyOjmbb8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/110717] Double-word sign-extension missed-optimization Date: Fri, 21 Jul 2023 16:46:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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=3D110717 --- Comment #14 from Andrew Pinski --- (In reply to Segher Boessenkool from comment #13) > So. Before expand we have >=20 > _6 =3D (__int128) x_3(D); > x.0_1 =3D _6 << 59; > _2 =3D x.0_1 >> 59; Jakub is trying to emulate this using shifts but this is better using bitfi= elds just to get the truncation: #ifdef __SIZEOF_INT128__ #define type __int128 #else #define type long long #endif struct f { #ifdef __SIZEOF_INT128__ __int128 t:(128-59); #else long long t:(64-27); #endif }; unsigned type foo (unsigned type x) { struct f t; t.t =3D x; return t.t; }=