[llvm] [RISCV] Handle more (add x, C) -> (sub x, -C) cases (PR #138705)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 09:57:41 PDT 2025
================
@@ -907,6 +907,19 @@ foreach vti = AllIntegerVectors in {
}
}
+// (add v, C) -> (sub v, -C) if -C cheaper to materialize
+foreach vti = I64IntegerVectors in {
+ let Predicates = [HasVInstructionsI64] in {
+ def : Pat<(add (vti.Vector vti.RegClass:$rs1),
+ (vti.Vector (SplatPat (i64 negImm:$rs2)))),
+// (riscv_vmv_v_x_vl undef, negImm:$rs2, srcvalue)),
----------------
topperc wrote:
I think its because ComplexPatterns can't nest. SplatPat and negImm are both ComplexPatterns.
https://github.com/llvm/llvm-project/pull/138705
More information about the llvm-commits
mailing list