From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 138E53858D32; Thu, 3 Nov 2022 21:21:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 138E53858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667510465; bh=U6Z0Uwz0X9fRCqWInfqTSWPxK/Vtp5PJTE2tT7XrcBA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rx0cAMcH5NU5wvHOckL1d1fGGVtTeC2pW/WU7+THcNyyYMNlr/xs7CtOp6UR7wlun /bbpFYgjR4DtiLT7Y89VMsZFvG3c7clYm+yJatfv6XMzNm/Go0B4BvVXnz/D1qHho2 BenXh7Eo1UCarEIpCp90WFePLDXyYAvhhc8h9l8Y= 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: Thu, 03 Nov 2022 21:21:04 +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 #23 from Vineet Gupta --- (In reply to Jeffrey A. Law from comment #20) > Yea, I think so (3 shifts). Two for masking, one to put the bits in the > right position. Then we just have to figure out how to combine the initi= al > shift with the 3 for the masking and ultimately result with just two :-) Does combine handle 3 split outputs ? If I hack my define_split to only have 2, I can see it split + matching the= 2 insn (final codegen is obviously bogus) Trying 7, 8, 9 -> 10: 7: r78:DI=3D0x1 8: r79:DI=3Dr78:DI<<0x26 REG_DEAD r78:DI REG_EQUAL 0x4000000000 9: r77:DI=3Dr79:DI-0x40 REG_DEAD r79:DI REG_EQUAL 0x3fffffffc0 10: r75:DI=3Dr76:DI&r77:DI REG_DEAD r77:DI REG_DEAD r76:DI Failed to match this instruction: (set (reg:DI 75) (and:DI (reg:DI 76) (const_int 274877906880 [0x3fffffffc0]))) Splitting with gen_split_37 (riscv.md:2089) Successfully matched this instruction: (set (reg:DI 77) (lshiftrt:DI (reg:DI 76) <------- (const_int 6 [0x6]))) Successfully matched this instruction: (set (reg:DI 75) (ashift:DI (reg:DI 77) <------- (const_int 32 [0x20])))=