From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FFE73857006; Wed, 2 Nov 2022 17:05:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FFE73857006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667408727; bh=KTUthWZ1WUSUGh4DbRejm/pM27gy1ASY1d+cxK4HjfQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZTvYCJw5qXq14lBzwYuj0zTEypxFZM3De2tOTBYDZlRZzUOGRNYlGwtaW3WWJaCO2 /8o1+vsKjQzlon2FH5QzQ7tn6bMWxClhcvaTbxr7bXFRNY/Hf54yBqSGGfhL8J5FMy oUX6jx/NOQ3GJIMT3gOWbSt+i8aP/0yvz8lbrIcc= From: "vineetg at rivosinc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106602] riscv: suboptimal codegen for zero_extendsidi2_shifted w/o bitmanip Date: Wed, 02 Nov 2022 17:05:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vineetg at rivosinc dot com 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: 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=3D106602 --- Comment #19 from Vineet Gupta --- (In reply to Jeffrey A. Law from comment #13) > Trying 7, 8, 9 -> 10: > 7: r140:DI=3D0x1 > 8: r141:DI=3Dr140:DI<<0x26 > REG_DEAD r140:DI > REG_EQUAL 0x4000000000 > 9: r139:DI=3Dr141:DI-0x40 > REG_DEAD r141:DI > REG_EQUAL 0x3fffffffc0 > 10: r137:DI=3Dr138:DI&r139:DI > REG_DEAD r139:DI > REG_DEAD r138:DI > Failed to match this instruction: > (set (reg:DI 137) > (and:DI (reg:DI 138) > (const_int 274877906880 [0x3fffffffc0]))) >=20 >=20 > That's what we're looking for. I think I had a wrong switch somewhere.=20 > Match that with a define_split and you should be good to go. I experimented with a define_split and initially saw it generate=20 slli a5,a0,32 srli a0,a5,6=20 but realized for both leading and trailing zeroes (either of arbitrary leng= th) we'll need 3 shifts ?=