Constant buffer, local, shared and global memory instructions
fixed bit field field the encoding fixes should be
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | |||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 1110 1111 0101 1---
Runs execute_LDS with Form() 1.
The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.
| Field | Bits | From |
|---|---|---|
| size | 50:48 | execute_LDS |
| immediate | 43:20 | execute_LDS |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
LDS and STS: shared memory at the register at 8 plus the signed offset at 20 (RZ: the offset alone), words of the size at 48-50 or a byte or halfword of the first, which a store puts in with a CAS loop (another lane may store the word's other bytes)
let store = Form() == 1;
let immediate = Bits32(SignExtend(Field(20, 24), 32)); /* made before the register's read */
let address = if RegA() == RZ then immediate else R_read(RegA()) + immediate;
let first = address >> 2;
let size = UInt(Field(48, 3));
foreach (k from 0 to SizeWords(size) - 1) {
let index0 = if k != 0 then first + to_bits(32, k) else first;
let pointer = SharedPointer(SharedIndex(index0, SharedWords()));
if size < 4 then {
let bit_offset = SubwordOffset(address, size);
let width = SubwordWidth(size);
if store then CasInsertShared(pointer, bit_offset, width, Dst())
else R_write(Dst(), SubwordExtract(AtomicLoadShared(pointer), bit_offset, width, size))
} else if store then Store(pointer, R_read(Dst() + k))
else R_write(Dst() + k, Load(pointer))
}
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).