[llvm] 72dfee1 - [RISCV] Remove mayLoad = 1 from store-conditional (#88470)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 08:45:50 PDT 2024
Author: Francis Visoiu Mistrih
Date: 2024-04-12T08:45:47-07:00
New Revision: 72dfee114bd38dc4b424d392bc14cd6b7dfb79e5
URL: https://github.com/llvm/llvm-project/commit/72dfee114bd38dc4b424d392bc14cd6b7dfb79e5
DIFF: https://github.com/llvm/llvm-project/commit/72dfee114bd38dc4b424d392bc14cd6b7dfb79e5.diff
LOG: [RISCV] Remove mayLoad = 1 from store-conditional (#88470)
lr.[wd]: mayLoad = 1, mayStore = 0
sc.[wd]: mayLoad = 0, mayStore = 1
all other AMOs: mayLoad = 1, mayStore = 1
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoA.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoA.td b/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
index 36842ceb49bfb8..814e0ddf111e63 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoA.td
@@ -30,6 +30,19 @@ multiclass LR_r_aq_rl<bits<3> funct3, string opcodestr> {
def _AQ_RL : LR_r<1, 1, funct3, opcodestr # ".aqrl">;
}
+let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
+class SC_r<bit aq, bit rl, bits<3> funct3, string opcodestr>
+ : RVInstRAtomic<0b00011, aq, rl, funct3, OPC_AMO,
+ (outs GPR:$rd), (ins GPRMemZeroOffset:$rs1, GPR:$rs2),
+ opcodestr, "$rd, $rs2, $rs1">;
+
+multiclass SC_r_aq_rl<bits<3> funct3, string opcodestr> {
+ def "" : SC_r<0, 0, funct3, opcodestr>;
+ def _AQ : SC_r<1, 0, funct3, opcodestr # ".aq">;
+ def _RL : SC_r<0, 1, funct3, opcodestr # ".rl">;
+ def _AQ_RL : SC_r<1, 1, funct3, opcodestr # ".aqrl">;
+}
+
let hasSideEffects = 0, mayLoad = 1, mayStore = 1 in
class AMO_rr<bits<5> funct5, bit aq, bit rl, bits<3> funct3, string opcodestr>
: RVInstRAtomic<funct5, aq, rl, funct3, OPC_AMO,
@@ -49,7 +62,7 @@ multiclass AMO_rr_aq_rl<bits<5> funct5, bits<3> funct3, string opcodestr> {
let Predicates = [HasStdExtAOrZalrsc], IsSignExtendingOpW = 1 in {
defm LR_W : LR_r_aq_rl<0b010, "lr.w">, Sched<[WriteAtomicLDW, ReadAtomicLDW]>;
-defm SC_W : AMO_rr_aq_rl<0b00011, 0b010, "sc.w">,
+defm SC_W : SC_r_aq_rl<0b010, "sc.w">,
Sched<[WriteAtomicSTW, ReadAtomicSTW, ReadAtomicSTW]>;
} // Predicates = [HasStdExtAOrZalrsc], IsSignExtendingOpW = 1
@@ -76,7 +89,7 @@ defm AMOMAXU_W : AMO_rr_aq_rl<0b11100, 0b010, "amomaxu.w">,
let Predicates = [HasStdExtAOrZalrsc, IsRV64] in {
defm LR_D : LR_r_aq_rl<0b011, "lr.d">, Sched<[WriteAtomicLDD, ReadAtomicLDD]>;
-defm SC_D : AMO_rr_aq_rl<0b00011, 0b011, "sc.d">,
+defm SC_D : SC_r_aq_rl<0b011, "sc.d">,
Sched<[WriteAtomicSTD, ReadAtomicSTD, ReadAtomicSTD]>;
} // Predicates = [HasStdExtAOrZalrsc, IsRV64]
More information about the llvm-commits
mailing list