FRINTM (vector)

Data processing (scalar floating-point and Advanced SIMD)

fixed bit field field the encoding fixes should be

Vector arithmetic unary fp16 round

313029282726252423222120191817161514131211109876543210
0Q00111001111001100110RnRd
Uo2o1

0x00111001111001100110xxxxxxxxxx

Decode Sail

if not_bool(HaveFP16Ext()) then {
    throw(Error_Undefined())
};
let 'd = UInt(Rd);
let 'n = UInt(Rn);
let 'esize = 16;
let 'datasize = if Q == 0b1 then 128 else 64;
let 'elements = DIV(datasize, esize);
exact : bool = false;
rounding : FPRounding = undefined;
match (U @ o1) @ o2 {
  [bitzero, _, _] => {
      rounding = FPDecodeRounding(o1 @ o2)
  },
  0b100 => {
      rounding = FPRounding_TIEAWAY
  },
  0b101 => {
      throw(Error_Undefined())
  },
  0b110 => {
      rounding = FPRoundingMode(FPCR_read());
      exact = true
  },
  0b111 => {
      rounding = FPRoundingMode(FPCR_read())
  }
};
let rounding = rounding;
execute_aarch64_instrs_vector_arithmetic_unary_fp16_round(d, datasize, elements, esize, exact, n, rounding)

Vector arithmetic unary float round

313029282726252423222120191817161514131211109876543210
0Q0011100sz100001100110RnRd
Uo2o1

0x0011100x100001100110xxxxxxxxxx

Decode Sail

let 'd = UInt(Rd);
let 'n = UInt(Rn);
if (sz @ Q) == 0b10 then {
    throw(Error_Undefined())
};
let 'esize = (32 << UInt(sz));
let 'datasize = if Q == 0b1 then 128 else 64;
let 'elements = DIV(datasize, esize);
exact : bool = false;
rounding : FPRounding = undefined;
match (U @ o1) @ o2 {
  [bitzero, _, _] => {
      rounding = FPDecodeRounding(o1 @ o2)
  },
  0b100 => {
      rounding = FPRounding_TIEAWAY
  },
  0b101 => {
      throw(Error_Undefined())
  },
  0b110 => {
      rounding = FPRoundingMode(FPCR_read());
      exact = true
  },
  0b111 => {
      rounding = FPRoundingMode(FPCR_read())
  }
};
let rounding = rounding;
execute_aarch64_instrs_vector_arithmetic_unary_fp16_round(d, datasize, elements, esize, exact, n, rounding)

Operation Sail

CheckFPAdvSIMDEnabled64();
let operand : bits('datasize) = V_read(n, datasize);
result : bits('datasize) = undefined;
element : bits('esize) = undefined;
foreach (e from 0 to (elements - 1) by 1 in inc) {
    element = Elem_read(operand, e, esize);
    result = Elem_set(result, e, esize, FPRoundInt(element, FPCR_read(), rounding, exact))
};
V_set(d, 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.