[llvm] [PowePC] using MTVSRBMI instruction instead of constant pool in power10+ (PR #144084)
Lei Huang via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 13:03:14 PDT 2025
================
@@ -9591,6 +9622,24 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(Op.getNode());
assert(BVN && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR");
+ if(Subtarget.hasP10Vector()) {
+ APInt BMI(32, 0);
+ // If the value of the vector is all zeros or all ones,
+ // we do not convert it to MTVSRBMI.
+ // The xxleqv instruction sets a vector with all ones.
+ // The xxlxor instruction sets a vector with all zeros.
+ if (isValidMtVsrbmi(BMI, *BVN) && BMI != 0 && BMI!=0xffff ) {
+ SDValue SDConstant= DAG.getTargetConstant(BMI, dl, MVT::i32);
+ MachineSDNode* MSDNode = DAG.getMachineNode(PPC::MTVSRBMI, dl,MVT::v16i8, SDConstant);
+ SDValue SDV = SDValue(MSDNode,0);
+ EVT DVT = BVN->getValueType(0);
+ EVT SVT = SDV.getValueType();
+ if (SVT != DVT ) {
+ SDV = DAG.getNode(ISD::BITCAST, dl, DVT, SDV);
----------------
lei137 wrote:
clang format
https://github.com/llvm/llvm-project/pull/144084
More information about the llvm-commits
mailing list