[llvm] [RISCV] Modify operand regclass in load store patterns (PR #133071)
Sudharsan Veeravalli via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 26 21:54:23 PDT 2025
https://github.com/svs-quic updated https://github.com/llvm/llvm-project/pull/133071
>From 96c2980214f3ea50c29f226f2af6e04e089cb8d3 Mon Sep 17 00:00:00 2001
From: Sudharsan Veeravalli <quic_svs at quicinc.com>
Date: Wed, 26 Mar 2025 17:44:43 +0530
Subject: [PATCH] [RVIU] Add GPRMem to operand in load store patterns
$rs1 is defined as GPRMem in the correspoding instruction definition classes.
---
llvm/lib/Target/RISCV/RISCVInstrInfo.td | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
index 253f24aa0d68d..b61992298ca95 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
@@ -1836,8 +1836,8 @@ def PseudoZEXT_W : Pseudo<(outs GPR:$rd), (ins GPR:$rs), [], "zext.w", "$rd, $rs
/// Loads
class LdPat<PatFrag LoadOp, RVInst Inst, ValueType vt = XLenVT>
- : Pat<(vt (LoadOp (AddrRegImm (XLenVT GPR:$rs1), simm12:$imm12))),
- (Inst GPR:$rs1, simm12:$imm12)>;
+ : Pat<(vt (LoadOp (AddrRegImm (XLenVT GPRMem:$rs1), simm12:$imm12))),
+ (Inst GPRMem:$rs1, simm12:$imm12)>;
def : LdPat<sextloadi8, LB>;
def : LdPat<extloadi8, LBU>; // Prefer unsigned due to no c.lb in Zcb.
@@ -1851,9 +1851,9 @@ def : LdPat<zextloadi16, LHU>;
class StPat<PatFrag StoreOp, RVInst Inst, RegisterClass StTy,
ValueType vt>
- : Pat<(StoreOp (vt StTy:$rs2), (AddrRegImm (XLenVT GPR:$rs1),
+ : Pat<(StoreOp (vt StTy:$rs2), (AddrRegImm (XLenVT GPRMem:$rs1),
simm12:$imm12)),
- (Inst StTy:$rs2, GPR:$rs1, simm12:$imm12)>;
+ (Inst StTy:$rs2, GPRMem:$rs1, simm12:$imm12)>;
def : StPat<truncstorei8, SB, GPR, XLenVT>;
def : StPat<truncstorei16, SH, GPR, XLenVT>;
More information about the llvm-commits
mailing list