ATOM

Constant buffer, local, shared and global memory instructions

fixed bit field field the encoding fixes should be

ATOM

6362616059585756555453525150494847464544434241403938373635343332
11101101
313029282726252423222120191817161514131211109876543210
pred.notpredRd

bits 63:48: 1110 1101 ---- ----

Runs execute_RED with Form() 1.

Fields

The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.

FieldBitsFrom
[55:52]55:52execute_RED
[51:49]51:49execute_RED
[25:23]25:23execute_RED
[22:20]22:20execute_RED
pred.not19the decoder
pred18:16the decoder
Rd7:0Dst()

Operation Sail

RED and ATOM on a global slot's word, each one 32 bits (shader_global_atomic_opcode): SPIR-V's atomic, or a CAS loop of a float add (size 3) or the wrap step (operation 3 INC, else DEC). ATOM returns the old value; RED's data is d

let red = Form() == 0;
let slot = GbAt() - 1;
let pointer = GlobalAtomicPointer(slot);
LogWritten(slot, AtomicOffset(), 4);
let value = R_read(if red then Dst() else RegB());
let opcode = GlobalAtomicOpcode(if red then 1 else 0);
let prior = if opcode != 4294967295 then AtomicOp(opcode, pointer, value)
            else AtomicLoop(pointer, value, if red then UInt(Field(20, 3)) else UInt(Field(49, 3)),
                            if red then UInt(Field(23, 3)) else UInt(Field(52, 4)));
if not_bool(red) then R_write(Dst(), prior)

Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Eden's maxwell.inc (GPL-2.0-or-later).