HalfOperand

sm86.sail

the operand of a 16-bit instruction as a pair of halves: its swizzle sw (0 both, 1 a float, 2 the low half in both, 3 the high one), then its absolute value and negation (an immediate has neither)

function HalfOperand(s : Operand, sw : int, what : string) -> half2 = {
    if sw == 1 then throw(Unsupported("%s with a float operand", what));
    let pair = UnpackHalf2(SrcBits(s));
    let swizzled = if sw >= 2 then {
        let h = Half2At(pair, sw - 2);
        Half2(h, h)
    } else pair;
    let absed = if SrcAbs(s) then Half2Abs(swizzled) else swizzled;
    if SrcNeg(s) then Half2Neg(absed) else absed
}

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.