SQRSHRN (vector)

Data processing (scalar floating-point and Advanced SIMD)

fixed bit field field the encoding fixes should be

Vector shift right narrow uniform scalar

313029282726252423222120191817161514131211109876543210
010111110immhimmb100111RnRd
Uop

010111110xxxxxxx100111xxxxxxxxxx

Decode Sail

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

Vector shift right narrow uniform SIMD

313029282726252423222120191817161514131211109876543210
0Q0011110immhimmb100111RnRd
Uop

0x0011110xxxxxxx100111xxxxxxxxxx

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;
let is_unsigned : bool = U == 0b1;
assert(constraint('esize in {4, 8, 16, 32, 64}));
execute_aarch64_instrs_vector_shift_right_narrow_uniform_sisd(d, datasize, elements, esize, n, part, round, shift, is_unsigned)

Operation Sail

CheckFPAdvSIMDEnabled64();
let operand : bits('datasize * 2) = V_read(n, datasize * 2);
result : bits('datasize) = undefined;
element : int = undefined;
sat : bool = undefined;
foreach (e from 0 to (elements - 1) by 1 in inc) {
    element = RShr(asl_Int(Elem_read(operand, e, 2 * esize), is_unsigned), shift, round);
    let (__tup_0 : bits('esize), __tup_1 : bool) =
      SatQ(element, esize, is_unsigned)
    in
      {
          result = Elem_set(result, e, esize, __tup_0);
          sat = __tup_1
      };
    if sat then {
        FPSR[QC] = 0b1
    };
    ()
};
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.