[PATCH] D140319: [RISCV] Match neg (and x, 1) to two shifts to improve codesize

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 12:16:34 PST 2022


craig.topper added a comment.

In D140319#4005826 <https://reviews.llvm.org/D140319#4005826>, @asb wrote:

> LGTM with Craig's comments addressed + RV32 test coverage.
>
> I think doing this even without the compressed extension probably makes sense. Surprisingly it seems there's a couple of cases in the GCC torture suite at O0 where `li a0, 0; sub a0, a0, a1` is selected rather than a `neg`. This patch also avoids avoids that - not that it's particularly important one way or another given how heavyweight the O0 output is in general.

Probably because we emit a copy from X0 and -O0 doesn't run the coalescer.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140319/new/

https://reviews.llvm.org/D140319



More information about the llvm-commits mailing list