[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 11:59:17 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.td:1244
+// is never compressible since rs1 and rd can't be the same register.
+let Predicates = [HasStdExtC] in {
+def : Pat<(XLenVT (sub 0, (and_oneuse GPR:$rs, 1))),
----------------
Any harm in doing this regardless of HasStdExtC? I've sort of been of the opinion that we should avoid CodeGen differences between C and non-C if we can.


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

https://reviews.llvm.org/D140319



More information about the llvm-commits mailing list