Skip to content

Commit b41f305

Browse files
author
Brendan Sweeney
committed
Making Zalasr lowering match the psABI (aka lb.aqrl and sb.aqrl are no longer used in the lowering)
1 parent 5cd0279 commit b41f305

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20506,12 +20506,12 @@ unsigned RISCVTargetLowering::getCustomCtpopCost(EVT VT,
2050620506
return isCtpopFast(VT) ? 0 : 1;
2050720507
}
2050820508

20509-
bool RISCVTargetLowering::shouldInsertFencesForAtomic(const Instruction *I) const {
20509+
bool RISCVTargetLowering::shouldInsertFencesForAtomic(
20510+
const Instruction *I) const {
2051020511
if (Subtarget.hasStdExtZalasr()) {
2051120512
return false;
20512-
} else {
20513-
return isa<LoadInst>(I) || isa<StoreInst>(I);
2051420513
}
20514+
return isa<LoadInst>(I) || isa<StoreInst>(I);
2051520515
}
2051620516

2051720517
bool RISCVTargetLowering::fallBackToDAGISel(const Instruction &Inst) const {

llvm/lib/Target/RISCV/RISCVInstrInfoZalasr.td

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,28 @@ class PatSRL<SDPatternOperator OpNode, RVInst Inst, ValueType vt = XLenVT>
7171

7272
let Predicates = [HasStdExtZalasr] in {
7373
def : PatLAQ<acquiring_load<atomic_load_8>, LB_AQ_AQ>;
74-
def : PatLAQ<seq_cst_load<atomic_load_8>, LB_AQ_AQ_RL>;
74+
def : PatLAQ<seq_cst_load<atomic_load_8>, LB_AQ_AQ>; // these use lb.aq instead of lb.aqrl to match the psABI
7575

7676
def : PatLAQ<acquiring_load<atomic_load_16>, LH_AQ_AQ>;
77-
def : PatLAQ<seq_cst_load<atomic_load_16>, LH_AQ_AQ_RL>;
77+
def : PatLAQ<seq_cst_load<atomic_load_16>, LH_AQ_AQ>;
7878

7979
def : PatLAQ<acquiring_load<atomic_load_32>, LW_AQ_AQ>;
80-
def : PatLAQ<seq_cst_load<atomic_load_32>, LW_AQ_AQ_RL>;
80+
def : PatLAQ<seq_cst_load<atomic_load_32>, LW_AQ_AQ>;
8181

8282
def : PatSRL<releasing_store<atomic_store_8>, SB_RL_RL>;
83-
def : PatSRL<seq_cst_store<atomic_store_8>, SB_RL_AQ_RL>;
83+
def : PatSRL<seq_cst_store<atomic_store_8>, SB_RL_RL>; // these use sb.rl instead of sb.aqrl to match the psABI
8484

8585
def : PatSRL<releasing_store<atomic_store_16>, SH_RL_RL>;
86-
def : PatSRL<seq_cst_store<atomic_store_16>, SH_RL_AQ_RL>;
86+
def : PatSRL<seq_cst_store<atomic_store_16>, SH_RL_RL>;
8787

8888
def : PatSRL<releasing_store<atomic_store_32>, SW_RL_RL>;
89-
def : PatSRL<seq_cst_store<atomic_store_32>, SW_RL_AQ_RL>;
89+
def : PatSRL<seq_cst_store<atomic_store_32>, SW_RL_RL>;
9090
} // Predicates HasStdExtZalasr
9191

9292
let Predicates = [HasStdExtZalasr, IsRV64] in {
9393
def : PatLAQ<acquiring_load<atomic_load_64>, LD_AQ_AQ>;
94-
def : PatLAQ<seq_cst_load<atomic_load_64>, LD_AQ_AQ_RL>;
94+
def : PatLAQ<seq_cst_load<atomic_load_64>, LD_AQ_AQ>;
9595

9696
def : PatSRL<releasing_store<atomic_store_64>, SD_RL_RL>;
97-
def : PatSRL<seq_cst_store<atomic_store_64>, SD_RL_AQ_RL>;
97+
def : PatSRL<seq_cst_store<atomic_store_64>, SD_RL_RL>;
9898
} // Predicates HasStdExtZalasr, IsRV64

0 commit comments

Comments
 (0)