ALD and AST: a geometry program's ALD names its input vertex in the register at 32 (from ISBERD), and its AST the output vertex's handle at 64 (from OUT), which SPIR-V's emits stand in for. The vertex index read once: the destination may be its register, as Maxwell's ALD reads it first
function Ald(load : bool) -> unit = {
let addr = UInt(Field(40, 10));
let comps = UInt(Field(74, 2)) + 1;
let vtx = if load then UInt(Field(32, 8)) else UInt(Field(64, 8));
let geometry = Stage() == ST_GS;
if UInt(Field(24, 8)) != RZ | (vtx != RZ & not_bool(geometry)) | Field(76, 2) != 0b00 | (load & Field(79, 1) == 0b1) then
throw(Unsupported("%s indexed, of a patch or of an output", OpName()));
let vertex = if geometry & load & vtx < RZ then R_read(vtx) else 0x00000000;
foreach (k from 0 to comps - 1) {
if load then {
if Dst() < RZ then R_write(Dst() + k, if geometry then GsAttrLoad(addr + 4 * k, vertex) else AttrLoad(addr + 4 * k))
} else {
let data = UInt(Field(32, 8));
AttrStore(addr + 4 * k, R_read(if data >= RZ then data else data + k))
}
}
}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.