From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D68E83858C60; Thu, 16 Feb 2023 18:21:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D68E83858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676571670; bh=Hq+Y0lg4ptkNoP2v7vTUFzxxuZKwGf+Xaakxb855e+4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r3O13joJcfknafJNVaZAL3Yy3Yz80kmN3gfkayRLARjzlSQ5QugM/8d05Q3NNUQ81 sVCY+/lx2TbR6IHEGbk/QhTgrHjyjZK7ReXlWfu39nNfjufW9LQxF1DbHD1tXULWJI 8r47lwkR8QO2QztBceykNdu9/3trb3qpdBZF8PzY= From: "palmer at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/108826] Inefficient address generation on POWER and RISC-V Date: Thu, 16 Feb 2023 18:21:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: palmer at gcc dot gnu.org 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=3D108826 --- Comment #5 from palmer at gcc dot gnu.org --- We've run into a handful of things that look like this before, I'm not sure= if it's a backend issue or something more general. There's two patterns here = that are frequently bad on RISC-V: "unsigned int" array indices and unsigned int shifting. I think they might both boil down to some problems we have track= ing the high parts of registers around ABI boundaries. FWIW, the smallest bad code I can get is unsigned int func(unsigned int ui) { return (ui >> 6 & 5) << 2; } func: srliw a0,a0,6 slliw a0,a0,2 andi a0,a0,20 ret which is particularly awkward as enough is going right to try and move that andi, but we still end up with the double shifts.=