[llvm] [LoongArch] Custom legalize vselect to vector_shuffle for most constant condition cases (PR #163489)
Zhaoxin Yang via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 00:10:37 PDT 2025
================
@@ -592,10 +592,57 @@ SDValue LoongArchTargetLowering::LowerOperation(SDValue Op,
return lowerVECREDUCE(Op, DAG);
case ISD::ConstantFP:
return lowerConstantFP(Op, DAG);
+ case ISD::VSELECT:
+ return lowerVSELECT(Op, DAG);
}
return SDValue();
}
+SDValue LoongArchTargetLowering::lowerVSELECT(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDValue Cond = Op.getOperand(0);
+ SDValue LHS = Op.getOperand(1);
+ SDValue RHS = Op.getOperand(2);
+ MVT VT = Op.getSimpleValueType();
+ SDLoc DL(Op);
+
+ // Try to lower vselect to vector_shuffle. All cases with constant
+ // build_vector condition will be handled. NOTE: On 32-bit platform, vselect
+ // with v2i64/v4i64 type condition will never enter this because of the extra
+ // bitcast. It can be considered separatly later.
----------------
ylzsx wrote:
separatly -> separately.
https://github.com/llvm/llvm-project/pull/163489
More information about the llvm-commits
mailing list