[llvm] 45494d9 - [RISCV] Fix address type in Zacas seq_cst atomic pattern (#190729)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 22:57:31 PDT 2026
Author: Jim Lin
Date: 2026-04-07T05:57:25Z
New Revision: 45494d9c165965a8f5aaccd00c7301c166bcd575
URL: https://github.com/llvm/llvm-project/commit/45494d9c165965a8f5aaccd00c7301c166bcd575
DIFF: https://github.com/llvm/llvm-project/commit/45494d9c165965a8f5aaccd00c7301c166bcd575.diff
LOG: [RISCV] Fix address type in Zacas seq_cst atomic pattern (#190729)
The seq_cst pattern in AMOCASPat used (vt GPR:$addr) for the address
operand, while all other patterns (monotonic, acquire, release, acq_rel)
consistently use (XLenVT GPR:$addr). This would produce a wrong type for
the address when vt differs from XLenVT (e.g., amocas.d on RV32 where
vt=i64).
Co-authored-by: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoZa.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZa.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZa.td
index 20e2142c70b48..8c96353cec5af 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZa.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZa.td
@@ -87,7 +87,7 @@ multiclass AMOCASPat<string AtomicOp, string BaseInst, ValueType vt = XLenVT,
(vt GPR:$cmp),
(vt GPR:$new)),
(!cast<RVInst>(BaseInst#"_AQRL") GPR:$cmp, GPR:$new, GPR:$addr)>;
- def : Pat<(!cast<PatFrag>(AtomicOp#"_seq_cst") (vt GPR:$addr),
+ def : Pat<(!cast<PatFrag>(AtomicOp#"_seq_cst") (XLenVT GPR:$addr),
(vt GPR:$cmp),
(vt GPR:$new)),
(!cast<RVInst>(BaseInst#"_AQRL") GPR:$cmp, GPR:$new, GPR:$addr)>;
More information about the llvm-commits
mailing list