On Mon, Sep 2, 2024 at 11:54 AM Jeff Law <jeffreya...@gmail.com> wrote:
> > This time with the RISC-V marker so the pre-commit testing system will > pick it up... Hi Jeff, Just a meta-note about precommit: If the patch contains riscv or risc-v anywhere in the patch file pre commit will run [1]. You can also cc patchworks...@rivosinc.com to run it. Since this patch edits something in the riscv/ directory, it doesn’t need the risc-v tag to trigger pre-commit [2]. Regardless, thanks for using the patchworks tester! :) Patrick [1] https://github.com/patrick-rivos/riscv-gnu-toolchain/blob/1496f76a9ad4081c0afdde8f7f8ffb22573a1789/scripts/create_patches_files.py#L89 [2] https://patchwork.sourceware.org/project/gcc/patch/7c038242-8663-4d94-9175-ea23397fa...@gmail.com/ > > > -------- Forwarded Message -------- > Subject: [to-be-committed] [PR target/115921] Improve reassociation for > rv64 > Date: Mon, 2 Sep 2024 11:53:44 -0600 > From: Jeff Law <jeffreya...@gmail.com> > To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org> > > > As Jovan pointed out in pr115921, we're not reassociating expressions > like this on rv64: > > (x & 0x3e) << 12 > > It generates something like this: > > li a5,258048 > slli a0,a0,12 > and a0,a0,a5 > > > We have a pattern that's designed to clean this up. Essentially > reassociating the operations so that we don't need to load the constant > resulting in something like this: > > andi a0,a0,63 > slli a0,a0,12 > > > That pattern wasn't working for certain constants due to its condition. > The condition is trying to avoid cases where this kind of reassociation > would hinder shadd generation on rv64. That condition was just written > poorly. > > This patch tightens up that condition in a few ways. First, there's no > need to worry about shadd cases if ZBA is not enabled. Second we can't > use shadd if the shift value isn't 1, 2 or 3. Finally rather than > open-coding one of the tests, we can use an existing operand predicate. > > The net is we'll start performing this transformation in more cases on > rv64 while still avoiding reassociation if it would spoil shadd generation. > > Waiting on the pre-commit testing before taking any further action. > > Jeff