[llvm] [WebAssembly] MC support for acquire-release atomics (PR #183656)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 13:55:06 PST 2026


================
@@ -370,6 +371,30 @@ void WebAssemblyInstPrinter::printWebAssemblyP2AlignOperand(const MCInst *MI,
   O << ":p2align=" << Imm;
 }
 
+void WebAssemblyInstPrinter::printWebAssemblyMemOrderOperand(const MCInst *MI,
+                                                             unsigned OpNo,
+                                                             raw_ostream &O) {
+  int64_t Imm = MI->getOperand(OpNo).getImm();
+  unsigned Opcode = MI->getOpcode();
+  bool IsFence = Opcode == WebAssembly::ATOMIC_FENCE ||
+                 Opcode == WebAssembly::ATOMIC_FENCE_S;
+
+  if (Imm == wasm::WASM_MEM_ORDER_SEQ_CST && !IsFence)
+    return;
----------------
dschuff wrote:

Probably a leftover from when IsFence was more different when the operand ordering was different.

I removed the !IsFence.
One other consequence of the decision to always use the backward-compatible encoding and printing is that the WASM_MEM_ORDER_SEQ_CST is dead code. I wasn't sure whether to leave it there for some possible future or not.

https://github.com/llvm/llvm-project/pull/183656


More information about the llvm-commits mailing list