[llvm] [RISCV][GISel] Added GISelPRedicateCodes to LeadingOnes*Mask (PR #119886)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 09:42:22 PST 2024
================
@@ -493,7 +493,15 @@ def LeadingOnesMask : PatLeaf<(imm), [{
if (!N->hasOneUse())
return false;
return !isInt<32>(N->getSExtValue()) && isMask_64(~N->getSExtValue());
-}], TrailingZeros>;
+}], TrailingZeros> {
+ let GISelPredicateCode = [{
+ if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg()))
+ return false;
+ const auto &MO = MI.getOperand(1);
----------------
topperc wrote:
GISel uses MachineIR where defs and uses are "operands". For G_CONSTANT, operand 0 is the def and operand 1 is the source.
SelectionDAG operands are only inputs. Results are separate.
The `(imm)` in the PatLeaf should guarantee this is only called for G_CONSTANT.
https://github.com/llvm/llvm-project/pull/119886
More information about the llvm-commits
mailing list