case ISD::STORE: {
auto *Store = cast<StoreSDNode>(N);
SDValue Val = Store->getValue();
- // Combine store of vmv.x.s to vse with VL of 1.
- // FIXME: Support FP.
- if (Val.getOpcode() == RISCVISD::VMV_X_S) {
+ // Combine store of vmv.x.s/vfmv.f.s to vse with VL of 1.
+ // vfmv.f.s is represented as extract element from 0. Match it late to avoid
+ // any illegal types.
+ if (Val.getOpcode() == RISCVISD::VMV_X_S ||
+ (DCI.isAfterLegalizeDAG() &&
+ Val.getOpcode() == ISD::EXTRACT_VECTOR_ELT &&
+ isNullConstant(Val.getOperand(1)))) {
SDValue Src = Val.getOperand(0);
MVT VecVT = Src.getSimpleValueType();
EVT MemVT = Store->getMemoryVT();
- // The memory VT and the element type must match.
- if (MemVT == VecVT.getVectorElementType()) {
+ // VecVT should be scalable and memory VT should match the element type.
+ if (VecVT.isScalableVector() &&
+ MemVT == VecVT.getVectorElementType()) {
SDLoc DL(N);
MVT MaskVT = getMaskTypeFor(VecVT);
return DAG.getStoreVP(
//===----------------------------------------------------------------------===//
let Predicates = [HasVInstructionsAnyF] in
foreach vti = AllFloatVectors in {
- // Fold store of vmv.f.s to a vse with VL=1.
- defvar store_instr = !cast<Instruction>("PseudoVSE"#vti.SEW#"_V_"#vti.LMul.MX);
-
- let AddedComplexity = 2 in {
- // Add complexity to increase the priority of this pattern being matched.
- def : Pat<(store (extractelt (vti.Vector vti.RegClass:$rs2), 0), GPR:$rs1),
- (store_instr vti.RegClass:$rs2, GPR:$rs1, 1, vti.Log2SEW)>;
- }
-
defvar vmv_f_s_inst = !cast<Instruction>(!strconcat("PseudoVFMV_",
vti.ScalarSuffix,
"_S_", vti.LMul.MX));