Skip to content

Commit 6943906

Browse files
authored
[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.
1 parent 902fe02 commit 6943906

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

llvm/lib/Target/RISCV/RISCVGISel.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ let Predicates = [HasAtomicLdSt] in {
118118
}
119119

120120
let Predicates = [HasAtomicLdSt, IsRV64] in {
121-
def : LdPat<atomic_load_nonext_32, LW, i32>;
121+
// Load pattern is in RISCVInstrInfoA.td and shared with RV32.
122122
def : StPat<atomic_store_32, SW, GPR, i32>;
123123
}
124124

llvm/lib/Target/RISCV/RISCVInstrInfoA.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,14 @@ let Predicates = [HasAtomicLdSt] in {
174174
def : StPat<relaxed_store<atomic_store_8>, SB, GPR, XLenVT>;
175175
def : StPat<relaxed_store<atomic_store_16>, SH, GPR, XLenVT>;
176176
def : StPat<relaxed_store<atomic_store_32>, SW, GPR, XLenVT>;
177-
}
178177

179-
let Predicates = [HasAtomicLdSt, IsRV32] in {
180-
def : LdPat<relaxed_load<atomic_load_nonext_32>, LW>;
178+
// Used by GISel for RV32 and RV64.
179+
def : LdPat<relaxed_load<atomic_load_nonext_32>, LW, i32>;
181180
}
182181

183182
let Predicates = [HasAtomicLdSt, IsRV64] in {
184-
def : LdPat<relaxed_load<atomic_load_asext_32>, LW>;
185-
def : LdPat<relaxed_load<atomic_load_zext_32>, LWU>;
183+
def : LdPat<relaxed_load<atomic_load_asext_32>, LW, i64>;
184+
def : LdPat<relaxed_load<atomic_load_zext_32>, LWU, i64>;
186185
def : LdPat<relaxed_load<atomic_load_nonext_64>, LD, i64>;
187186
def : StPat<relaxed_store<atomic_store_64>, SD, GPR, i64>;
188187
}

0 commit comments

Comments
 (0)