Skip to content

Commit 8744287

Browse files
authored
[RISCV][GISel] Use relaxed_load/store in GISel atomic patterns. NFC (#161712)
We have additional patterns for GISel because we need to make s16 and s32 legal for load/store. GISel does not distinquish integer and FP scalar types in LLT. We only know whether the load should be integer or FP after register bank selection. These patterns should have been updated to use relaxed_load/store when the patterns in RISCVInstrInfoA.td were updated. Without this we will miscompile loads/stores with strong memory ordering when Zalasr is enabled. This patch just fixes the miscompile, Zalasr will now cause a GISel abort in some cases. A follow up patch will add additional GISel patterns for Zalasr.
1 parent 715e0fa commit 8744287

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Target/RISCV/RISCVGISel.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ def : StPat<truncstorei8, SB, GPR, i16>;
110110

111111
let Predicates = [HasAtomicLdSt] in {
112112
// Prefer unsigned due to no c.lb in Zcb.
113-
def : LdPat<atomic_load_aext_8, LBU, i16>;
114-
def : LdPat<atomic_load_nonext_16, LH, i16>;
113+
def : LdPat<relaxed_load<atomic_load_aext_8>, LBU, i16>;
114+
def : LdPat<relaxed_load<atomic_load_nonext_16>, LH, i16>;
115115

116-
def : StPat<atomic_store_8, SB, GPR, i16>;
117-
def : StPat<atomic_store_16, SH, GPR, i16>;
116+
def : StPat<relaxed_store<atomic_store_8>, SB, GPR, i16>;
117+
def : StPat<relaxed_store<atomic_store_16>, SH, GPR, i16>;
118118
}
119119

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

125125
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)