From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E764D3858426; Fri, 6 Oct 2023 19:37:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E764D3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696621073; bh=VzpJl+3AerD2RzptR1w7f/+ItshqR0bSm23hXjFjYLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BF531WO2+4fjL/nFQL7lnJiBha+KnuWvG82jeqf185K1ON2zyRVA9LWy8Oe/I8ZLU Mdyi/OhrQjTJFnsBT3CdGGMUg8VAfaq1uOblQzt8f1zTYbtzl6FWq8XtY5Ywd8NMhL fNzRSouTN3UqiDL5vr+o8p17uCBRb76yPj28IrZo= 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: Fri, 06 Oct 2023 19:37:53 +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 #18 from Vineet Gupta --- (In reply to Vineet Gupta from comment #17) > (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; > > > } > > > ``` > > li a0,16842752 > > addi a0,a0,257 > > li a5,16842752 > > slli a0,a0,32 > > addi a5,a5,257 > > or a0,a5,a0 > > ret >=20 > This is again IRA inflicted pain (similar to [PR110748]).=20 > IRA seems to be undoing split1 since we have 2 insn sequences to synthesi= ze > the constant pieces. This explains why the problem got exacerbated with > commit 0530254413f8 ("riscv: relax splitter restrictions for creating > pseudos") since now different regs are used to create parts of const, vs 1 > reg being repeatedly used for assembling a const (fooling IRA's equivalent > replacement logic). After commit=20 2023-08-18 a047513c9222 RISC-V: Enable pressure-aware scheduling by default.=20=20 the test above has improved. li a5,16842752 addi a5,a5,257 mv a0,a5 slli a5,a5,32 or a0,a0,a5 ret=