[llvm] [llvm][RISCV] Support P Extension CodeGen (PR #190303)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 21:05:46 PDT 2026
================
@@ -1796,10 +1796,26 @@ let Predicates = [HasStdExtP] in {
// Basic 8-bit arithmetic patterns
def : PatGprGpr<add, PADD_B, XLenVecI8VT>;
def : PatGprGpr<sub, PSUB_B, XLenVecI8VT>;
+ def : Pat<(XLenVecI8VT
+ (add (XLenVecI8VT GPR:$rs1),
+ (XLenVecI8VT (splat_vector (XLenVT GPR:$rs2))))),
+ (PADD_BS GPR:$rs1, GPR:$rs2)>;
+ def : Pat<(XLenVecI8VT
+ (add (XLenVecI8VT (splat_vector (XLenVT GPR:$rs2))),
+ (XLenVecI8VT GPR:$rs1))),
+ (PADD_BS GPR:$rs1, GPR:$rs2)>;
----------------
kito-cheng wrote:
1. I am not family with DAG stuffs, do we need those two variants? I mean add has marked as SDNPCommutative, I thought LLVM should be able to do that automatically?
2. Maybe add a PatGprSplatGpr class like PatGprGpr? I assume we need to add few more `*.*s` patterns?
https://github.com/llvm/llvm-project/pull/190303
More information about the llvm-commits
mailing list