From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AA6833858C00; Wed, 2 Nov 2022 01:24:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA6833858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667352273; bh=dVTEg6datfXMl9sm110E/kVOnpxUgi3ISfWtNRXMDOo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qQGQGu9V5ptYh/j/Ec9Mf1D6HbxYpNQojDbLcP8d1Epx8SFdZ/vnchFNZDFCUPK6p GOC/xa+6QtjYoOxDeoLp3jtTyVxMDwxuuM428OxsTmNFbH8qioPXhx3v9nnQFOA+T2 mAS5I4FCrfGfMXgAVLzcp9auWhzIpsN0N9I9f944= 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 01:24:33 +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: normal 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 #14 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 think you are missing the original left shift 6. So insn 6 from my dumps is important if we are to match zero_extendsidi2_shifted which matches and+shift (iff 3>>2=3D=3D0xffffffff). But it feels like you agree on using REG_EQUAL note (if avail) to created merged pattern in try_combine() as opposed to my original thinking of only doing it if regular pattern match failed.=