[llvm] Generate `kmov` for masking integers (PR #120593)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 18:55:45 PST 2024
================
@@ -4975,12 +4975,70 @@ bool X86DAGToDAGISel::tryVPTESTM(SDNode *Root, SDValue Setcc,
return tryFoldBroadcast(Root, P, L, Base, Scale, Index, Disp, Segment);
};
+ auto canUseKMOV = [&]() {
+ if (Src0.getOpcode() != X86ISD::VBROADCAST)
+ return false;
+
+ if (Src1.getOpcode() != ISD::LOAD ||
+ Src1.getOperand(1).getOpcode() != X86ISD::Wrapper ||
+ Src1.getOperand(1).getOperand(0).getOpcode() != ISD::TargetConstantPool)
+ return false;
+
+ const auto *ConstPool =
+ dyn_cast<ConstantPoolSDNode>(Src1.getOperand(1).getOperand(0));
+ if (!ConstPool)
+ return false;
+
+ const auto *ConstVec = ConstPool->getConstVal();
+ const auto *ConstVecType = dyn_cast<FixedVectorType>(ConstVec->getType());
+ if (!ConstVecType)
+ return false;
+
+ for (unsigned i = 0, e = ConstVecType->getNumElements(), k = 1; i != e;
----------------
phoebewang wrote:
Use upper case I, J, E.
https://github.com/llvm/llvm-project/pull/120593
More information about the llvm-commits
mailing list