[PATCH] D102398: [RISCV] Optimize or/xor with immediate
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 13 13:54:47 PDT 2021
luismarques added a comment.
We need to optimize integer materialization, both in general and to take advantage of bitmanip. I suppose that the baseline test would be less bad if we had done that, but that this optimization would still be worth it?
================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:1293
+ if (auto *ConstOp = dyn_cast<ConstantSDNode>(N)) {
+ // The immediate operand must have only use.
+ if (!(ConstOp->hasOneUse()))
----------------
The code already seems self-explanatory. Remove?
================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:1299
+ return false;
+ // The immediate should has only two set bits.
+ if (countPopulation(ConstOp->getZExtValue()) == 2) {
----------------
"The immediate must have exactly two bits set."
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoB.td:90
+// Check if this mask has only two set bits and is used only once.
+def BSETINVTwoBitsMask : ComplexPattern<XLenVT, 1, "selectTwoBitsMask">;
----------------
"only two set bits" -> "two set bits", otherwise it seems it's "up to two bits"
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102398/new/
https://reviews.llvm.org/D102398
More information about the llvm-commits
mailing list