function Shf(dtype : int) -> unit = {
let width = if dtype < 2 then 64 else 32;
let right = Field(76, 1) == 0b1;
let is_signed = dtype == 0 | dtype == 2;
var s : bits(32) = SrcBits(B);
if Field(75, 1) == 0b1 then { s = s & to_bits(32, width - 1) } else { s = to_bits(32, Min(UInt(s), width)) };
let lo = SrcBits(A);
let hi = SrcBits(C);
let value = hi @ lo;
let s64 = ZeroExtend(s, 64);
let big = 63 < UInt(s);
let s_part = if big then 0x000000000000003f else s64;
let extra = if big then 0x0000000000000001 else 0x0000000000000000;
let shifted : bits(64) = if not_bool(right) then LSL(LSL(value, s_part), extra)
else if is_signed then ASR(ASR(value, s_part), extra)
else LSR(LSR(value, s_part), extra);
if Field(80, 1) == 0b1 then D_write(shifted[63 .. 32]) else D_write(shifted[31 .. 0])
}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.