[llvm] 6943906 - [RISCV][GISel] Share an atomic load isel pattern GISel RV64 and SDAG RV32. NFC (#161721)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 12:50:12 PDT 2025
Author: Craig Topper
Date: 2025-10-02T12:50:09-07:00
New Revision: 694390679ac1351a8d471d39db85400eb21a9035
URL: https://github.com/llvm/llvm-project/commit/694390679ac1351a8d471d39db85400eb21a9035
DIFF: https://github.com/llvm/llvm-project/commit/694390679ac1351a8d471d39db85400eb21a9035.diff
LOG: [RISCV][GISel] Share an atomic load isel pattern GISel RV64 and SDAG RV32. NFC (#161721)
Use stricter type for RV64 only patterns.
Stores are different because atomic_store doesn't differentiate
truncating and non-truncating stores.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVGISel.td
llvm/lib/Target/RISCV/RISCVInstrInfoA.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVGISel.td b/llvm/lib/Target/RISCV/RISCVGISel.td
index 19d5aff023d53..af1ceb6bcda4e 100644
--- a/llvm/lib/Target/RISCV/RISCVGISel.td
+++ b/llvm/lib/Target/RISCV/RISCVGISel.td
@@ -118,7 +118,7 @@ let Predicates = [HasAtomicLdSt] in {
}
let Predicates = [HasAtomicLdSt, IsRV64] in {
- def : LdPat<atomic_load_nonext_32, LW, i32>;
+ // Load pattern is in RISCVInstrInfoA.td and shared with RV32.
def : StPat<atomic_store_32, SW, GPR, i32>;
}
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoA.td b/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
index 99992d196b43d..25accd93eaa03 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
@@ -174,15 +174,14 @@ let Predicates = [HasAtomicLdSt] in {
def : StPat<relaxed_store<atomic_store_8>, SB, GPR, XLenVT>;
def : StPat<relaxed_store<atomic_store_16>, SH, GPR, XLenVT>;
def : StPat<relaxed_store<atomic_store_32>, SW, GPR, XLenVT>;
-}
-let Predicates = [HasAtomicLdSt, IsRV32] in {
- def : LdPat<relaxed_load<atomic_load_nonext_32>, LW>;
+ // Used by GISel for RV32 and RV64.
+ def : LdPat<relaxed_load<atomic_load_nonext_32>, LW, i32>;
}
let Predicates = [HasAtomicLdSt, IsRV64] in {
- def : LdPat<relaxed_load<atomic_load_asext_32>, LW>;
- def : LdPat<relaxed_load<atomic_load_zext_32>, LWU>;
+ def : LdPat<relaxed_load<atomic_load_asext_32>, LW, i64>;
+ def : LdPat<relaxed_load<atomic_load_zext_32>, LWU, i64>;
def : LdPat<relaxed_load<atomic_load_nonext_64>, LD, i64>;
def : StPat<relaxed_store<atomic_store_64>, SD, GPR, i64>;
}
More information about the llvm-commits
mailing list