SHRN (vector)

Data processing (scalar floating-point and Advanced SIMD)

fixed bit field field the encoding fixes should be

Vector shift right narrow logical

313029282726252423222120191817161514131211109876543210
0Q0011110immhimmb100001RnRd
op

0x0011110xxxxxxx100001xxxxxxxxxx

Decode Sail

let 'd = UInt(Rd);
let 'n = UInt(Rn);
if immh == 0b0000 then {
    throw(Error_See("asimdimm"))
};
if [immh[3]] == 0b1 then {
    throw(Error_Undefined())
};
let 'esize = (8 << HighestSetBit(immh));
let 'datasize = 64;
let 'part = UInt(Q);
let 'elements = DIV(datasize, esize);
let 'shift = 2 * esize - UInt(immh @ immb);
let round : bool = op == 0b1;
assert(constraint('esize in {4, 8, 16, 32, 64}));
execute_aarch64_instrs_vector_shift_right_narrow_logical(d, datasize, elements, esize, n, part, round, shift)

Operation Sail

CheckFPAdvSIMDEnabled64();
let operand : bits('datasize * 2) = V_read(n, datasize * 2);
result : bits('datasize) = undefined;
element : int = undefined;
foreach (e from 0 to (elements - 1) by 1 in inc) {
    element = RShr(UInt(Elem_read(operand, e, 2 * esize)), shift, round);
    result = Elem_set(result, e, esize, element[esize - 1 .. 0])
};
Vpart_set(d, part, datasize) = result

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.