From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 828C8385B835; Sat, 18 Apr 2020 01:49:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 828C8385B835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587174568; bh=5VsHnVp6V1bmmMRVQR7gm7BFB+B+zzoKfk75VKGYWBg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EgBD+tu/MXiVzByuqr0MT7pXnF92bi9p+w6iuRCfejQml5fZe+3j5rw925MJQtrfe AXYWQwBqmmWNrvZ6126uUvuIyf6mijpgGhyw9Xs+moYEZz3NiYvdks3tbWe5ozwngh uh4XemQPXUYJg1ooZH68tShq23L/MG0bUwpBlBDY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94643] [sign extension of nonnegative value from 32 to 64 bits Date: Sat, 18 Apr 2020 01:49:28 +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: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed keywords bug_status cf_reconfirmed_on short_desc bug_severity component 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2020 01:49:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94643 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2020-04-18 Summary|[x86_64] gratuitous sign |[sign extension of |extension of nonnegative |nonnegative value from 32 |value from 32 to 64 bits |to 64 bits Severity|normal |enhancement Component|target |tree-optimization --- Comment #1 from Andrew Pinski --- This could be done on the tree level: Given (where _1 is short unsigned): _2 =3D (int) _1; _3 =3D _2 * 16; _6 =3D (uint64_t) _3; We should be able to convert this to: _7 =3D (uint64_t) _1; _6 =3D _7 << 4; But there might be a few steps inbetween. I will let someone decide on how= it would work. This is true even on AARCH64: adrp x1, a add x1, x1, :lo12:a ldrh w0, [x1, w0, sxtw 1] ubfiz x0, x0, 4, 16 ret But ubfiz is the the zero extend and shift in one instruction so it does not matter in the end ...=