diff --git a/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td index e18a46adbf2..e1ae6f9fb1e 100644 --- a/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -32,12 +32,10 @@ def riscv_trunc_vector : SDNode<"RISCVISD::TRUNCATE_VECTOR", SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>]>>; -// Penalize the generic form with Complexity=1 to give the simm5/uimm5 variants -// precedence -def SplatPat : ComplexPattern; - -def SplatPat_simm5 : ComplexPattern; -def SplatPat_uimm5 : ComplexPattern; +// Give explicit Complexity to prefer simm5/uimm5. +def SplatPat : ComplexPattern; +def SplatPat_simm5 : ComplexPattern; +def SplatPat_uimm5 : ComplexPattern; def RVVBaseAddr : ComplexPattern; @@ -714,10 +712,10 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { let Predicates = [HasStdExtV] in { foreach vti = AllIntegerVectors in { - def : Pat<(vti.Vector (splat_vector GPR:$rs1)), + def : Pat<(vti.Vector (SplatPat GPR:$rs1)), (!cast("PseudoVMV_V_X_" # vti.LMul.MX) GPR:$rs1, vti.AVL, vti.SEW)>; - def : Pat<(vti.Vector (splat_vector simm5:$rs1)), + def : Pat<(vti.Vector (SplatPat_simm5 simm5:$rs1)), (!cast("PseudoVMV_V_I_" # vti.LMul.MX) simm5:$rs1, vti.AVL, vti.SEW)>; } @@ -730,19 +728,6 @@ foreach mti = AllMasks in { } } // Predicates = [HasStdExtV] -let Predicates = [HasStdExtV, IsRV32] in { -foreach vti = AllIntegerVectors in { - if !eq(vti.SEW, 64) then { - def : Pat<(vti.Vector (rv32_splat_i64 GPR:$rs1)), - (!cast("PseudoVMV_V_X_" # vti.LMul.MX) - GPR:$rs1, vti.AVL, vti.SEW)>; - def : Pat<(vti.Vector (rv32_splat_i64 simm5:$rs1)), - (!cast("PseudoVMV_V_I_" # vti.LMul.MX) - simm5:$rs1, vti.AVL, vti.SEW)>; - } -} -} // Predicates = [HasStdExtV, IsRV32] - let Predicates = [HasStdExtV, HasStdExtF] in { foreach fvti = AllFloatVectors in { def : Pat<(fvti.Vector (splat_vector fvti.ScalarRegClass:$rs1)), diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 394a0e1c172..0bfb695e8fc 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -3472,6 +3472,9 @@ private: if (N->getNumChildren() != 1 || !N->getChild(0)->isLeaf()) return false; + if (N->getOperator()->isSubClassOf("ComplexPattern")) + return false; + const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator()); if (OpInfo.getNumResults() != 1 || OpInfo.getNumOperands() != 1) return false;