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

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 12:12:40 PST 2022


asb added a comment.

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.


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

https://reviews.llvm.org/D140319



More information about the llvm-commits mailing list