From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF4EF3856965; Tue, 15 Aug 2023 17:37:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF4EF3856965 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692121023; bh=xxQ0LgGHAUeYGPz48qbCbucC2iN/xHRroxF5Z6Pc5A8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tHS/PrYH4m0g5jwiexAIKAGG4+1oL42y1HoA4bl3mo9j8y1YPNYqxN2fWuUJA6skS Z9C3jZmVEWG7BqptxWdxz2bBYQ6AK5NGhJuIwauQJcpLM1YC79Os/1DD6JCLPXILic uuPiAqBMh0QCfo04thOh8HXQcDuUau95rlWTXMu4= From: "vineetg at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109279] RISC-V: complex constants synthesized should be improved Date: Tue, 15 Aug 2023 17:37:02 +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: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: vineetg at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED 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=3D109279 --- Comment #17 from Vineet Gupta --- (In reply to Vineet Gupta from comment #16) > > Which is what this produces: > > ``` > > long long f(void) > > { > > unsigned t =3D 16843009; > > long long t1 =3D t; > > long long t2 =3D ((unsigned long long )t) << 32; > > asm("":"+r"(t1)); > > return t1 | t2; > > } > > ``` >=20 > li a0,16842752 > addi a0,a0,257 > li a5,16842752 > slli a0,a0,32 > addi a5,a5,257 > or a0,a5,a0 > ret This is again IRA inflicted pain (similar to [PR110748]).=20 IRA seems to be undoing split1 since we have 2 insn sequences to synthesize= the constant pieces. This explains why the problem got exacerbated with commit 0530254413f8 ("riscv: relax splitter restrictions for creating pseudos") si= nce now different regs are used to create parts of const, vs 1 reg being repeat= edly used for assembling a const (fooling IRA's equivalent replacement logic).=