[PATCH] D108916: [RISCV] Optimize (add (shl x, c0), (shl y, c1)) with SH*ADD
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 04:06:01 PDT 2021
luismarques accepted this revision.
luismarques added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5771
+
+ // Skip for vevtor types and larger types.
+ EVT VT = N->getValueType(0);
----------------
Nit: vector
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5793-5794
+ // Skip if SH1ADD/SH2ADD/SH3ADD are not applicable.
+ int64_t Bits = std::min(C0, C1);
+ int64_t Diff = std::max(C0, C1) - Bits;
+ if (Diff != 1 && Diff != 2 && Diff != 3)
----------------
Is this just `abs(C1 - C0)`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108916/new/
https://reviews.llvm.org/D108916
More information about the llvm-commits
mailing list