Ldg

sm86.sail

LDG, STG and their forms without the uniform register: a pointer from memory, or derived from one, that no buffer key names is GlobalDynamic's; else the global buffer the address is in

function Ldg(load : bool, uniform_form : bool) -> unit = {
    if AddressFromMemory() then GlobalDynamic(if load then 1 else 0, 0, 0) else {
        let buffer = GlobalAddress(if uniform_form then 1 else 0, if load then 0 else 1);
        if buffer != 0 then {
            let kind = UInt(Field(73, 3));
            if load then MemLoad(buffer, kind, Dst()) else {
                MarkWritten(if kind < 2 then 1 else if kind < 4 then 2 else if kind == 4 then 4 else if kind == 5 then 8 else 16);
                MemStore(buffer, kind, UInt(Field(32, 8)))
            }
        }
    }
}

Used by


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 Mesa's NAK (sm70_encode.rs, MIT) and CuAssembler's sm_86 records.