[llvm] 80a7754 - [RISCV] Move FP store of extractelt pattern to DAGCombine.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 19:01:56 PST 2023
Author: Craig Topper
Date: 2023-01-11T19:01:46-08:00
New Revision: 80a7754c359e6d9db2c7ff32bfac5e9422af14ce
URL: https://github.com/llvm/llvm-project/commit/80a7754c359e6d9db2c7ff32bfac5e9422af14ce
DIFF: https://github.com/llvm/llvm-project/commit/80a7754c359e6d9db2c7ff32bfac5e9422af14ce.diff
LOG: [RISCV] Move FP store of extractelt pattern to DAGCombine.
This makes it the same as integer.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 74c4bba72ee9..169ff9d22f98 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -10435,14 +10435,19 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
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(
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
index aec02162a2fd..c07bb775c796 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
@@ -1035,15 +1035,6 @@ foreach fvti = AllFloatVectors in {
//===----------------------------------------------------------------------===//
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));
More information about the llvm-commits
mailing list