Hi Keith, You added the opcode to the `ATOMIC_STORE_LIST` in this CL <https://github.com/KayTeo/v8/commit/c17e05f47bac4383f9b94d51720f97e184f6f5e9> and used the same `StoreType` as the existing store. This makes your new instruction identical to the existing "i32.atomic.store" instruction. Since you want to pass additional information about the memory ordering down to code generation, I would propose introducing a new enum for this, like `enum MemoryOrdering { kSeqCst, kRelease}`, and passing that to the existing `AtomicStoreMem` helper. You could then just handle your new opcode explicitly in the existing switch in `AtomicOp`: `case kExprI32AtomicStoreRelease: AtomicStoreMem(decoder, StoreType::kI32Store, imm, MemoryOrdering::kRelease); break;`. The `LiftoffCompiler::AtomicStore` method would then pass the `MemoryOrdering` down to `LiftoffAssembler::AtomicStore`, where you would emit a `movl` instead of `xchgl` if the new parameter is `MemoryOrdering::kRelease`.
Hope that helps, Clemens On Mon, Jan 13, 2025 at 9:02 PM Keith Teo <keithteokai...@gmail.com> wrote: > Hi all, > > I am trying to add a new WASM release atomic store opcode (instead of the > default seqcst atomic store). I aim to compile it on x64 to MOV, while the > current i32.atomic.store compiles to (LOCK) XCHG. I've made a number of > changes, largely at the functions/macros where WASM opcodes are lowered to > native x64 code, by creating a new instruction similar to i32.atomic.store > but emitting MOV instead. I've got it to accept my new opcode, and it runs > without error in d8, but checking the output of compiling with the standard > i32.atomic.store and the new opcode there's no difference. And looking > deeper into the code, there's a lot of higher level functions that deals > more abstractly with atomicity, memory ordering and such which is beyond me > to understand right now. > > Could anyone point me in the right direction of what I would need to add > and in which files? > > Some details: > > 1) I am targeting the Liftoff compiler > 2) The new opcode is named i32.atomic.store.release, with opcode fe04 > (original i32.atomic.store has opcode fe17) > > You can see the changes I made here > https://github.com/KayTeo/v8/commits/main/ > > Thanks, > Keith > > -- > -- > v8-dev mailing list > v8-dev@googlegroups.com > http://groups.google.com/group/v8-dev > --- > You received this message because you are subscribed to the Google Groups > "v8-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-dev+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/v8-dev/1df186f5-e26f-489c-82cc-f2ae9a74a454n%40googlegroups.com > <https://groups.google.com/d/msgid/v8-dev/1df186f5-e26f-489c-82cc-f2ae9a74a454n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Clemens Backes Software Engineer cleme...@google.com Google Germany GmbH Erika-Mann-Straße 33 80636 München Geschäftsführer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person. -- -- v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/v8-dev/CAGO%3DqhA1bRRnS%3Dg%3Duj5_p-B3Use65gXr73%3DHY0Lw5WDOAaWVaw%40mail.gmail.com.