# wasm: implement \`@atomicRmw\` · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/b19c258f045aa1653b4e38ba2ff96302d914eea2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: b19c258f045aa1653b4e38ba2ff96302d914eea2

Requested commit: b19c258f045aa1653b4e38ba2ff96302d914eea2

Commit: b19c258f045aa1653b4e38ba2ff96302d914eea2

Tree: 581bb2724a6b27589fe7f9ce377aab68eb7fd58c

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: implement `@atomicRmw`

Implements the lowering of the `@atomicRmw` builtin. Uses the atomic
opcodes when the cpu feature `atomics` is enabled. Otherwise lowers
it to regular instructions. For the operations that do not lower to
a direct atomic opcode, we use a loop in combiantion with a cmpxchg
to ensure the swapping of values is doing atomically.

```

## Parents

- [fd47eddc862b0a5bd90949fe21cf87a716c5464c](https://git.cafe/gitcafe/zig/commit/fd47eddc862b0a5bd90949fe21cf87a716c5464c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/b19c258f045aa1653b4e38ba2ff96302d914eea2?format=markdown)
